In this video series, the self-taught developer will assist you to learn about how to understand which method is best used when wanting to manipulate files on the server. It can be sometimes that you do not want to create a new file if the file already exists. Or possibly that you want to append data to the file if it exists, and if the file does not exist, then the file should first be created and then the data should be written to the file.
If you want to create a directory, first you need to check if the directory exists, if not then the directory must be created. The PHP file system allows for you to understand if a resource within a directory is either a file and a directory. Also if the resource is executable, readable, and writable. Basically said, it means that the PHP will function will allow your application to know if the directory can be read from, written to, and also if the file can be executed.
The PHP functions are written in the C programming but are very well documented. You will not actually be having to program in C, the functions are wrapped in PHP code so that you can access them directly.
Reading and writing from the file system, require that PHP has the correct file permissions before you start. This will be explained in the video series about the PHP file system. It also matters on which platform you are working on. If your PHP server is running on a Linux system, then you will have other types of file permissions.
By the end of this video series, you will have a very good understanding about how you can create a file, create a folder, check if a file exists, check if a folder exists, check if a resource is either a file or directory, check if you can read from the directory, check if you can read from a file, check which permissions the application running has with the file system, understanding the hidden byte, understand how to read a byte at a time when the data is being read from the stdin, understand about how to scan the directory, understand how to tell what is the current directory and how you can change the directory to another directory within your code.
There are many other things that you can learn whilst learn how to code in PHP.
This is a really good step for you to become a web developer or a software developer. It will also teach you how to save files to the server when using an upload system in your website because once you have received the uploaded file, you will need to create a new file on your server and then move the temp file to the new file that you want to save it to. It can also be that you want to create a folder for the file to be saved into.
It can be also that you want for the user data to be used when trying to access that file, for example, if the user that has uploaded the file does not have the file permissions to access the file or directory on the server, then the PHP or C function will not have the correct permission to either read, write, delete data to or from the file.
The PHP website and documentation can assist you with these questions
The functions in php that we will use in these videos are as follows: is_dir, file_exists, fopen, opendir, readdir, fgets, gets, scandir, scandir, readline, move_uploaded_file, array_key_exists, shift, pop, array, php, classes, functions, interfaces.