Did you know that PHP has operating system functions? Did you know that you could create directories, delete directories, and scan a directory using PHP? You can do these things and more in PHP, independent of the operating system of the computer. In this article, I introduce you to a tutorial series that explains PHP Directory Function Basics. After completing the series, your handling of directories will become more flexible and automatic from PHP. For example, you will be able to create a text file with PHP and save the file still with PHP, in a directory of your choice. Manipulation of directories uses PHP functions.
At the moment, it is a 6 part series.
The First Part of the Series
The first part of the series explains how you can open and close a directory. Opening a directory here, means, you obtain a variable that you can use to access the content of the directory. Closing a directory, means you put an end to the use of the variable to access the directory (content). All that is done in program code. The first part of the series also talks how you can read the names of the files and sub-directories in a directory.
The Second Part of the Series
This part of the tutorial series explains how to create and delete directories.
The Third Part of the Series
This part of the series explains the meaning of the current directory and how to work with it.
The Fourth Part of the Series
This part of the series explains how to use the directory functions with the if-construct.
The Fifth Part of the Series
This part of the series explains how to obtain a list of the names of files and sub-directories in a directory.
The Sixth Part of the Series
After obtaining a list of the directory items, you need to know which item is a directory and which is a file. This part of the series explains how to achieve that.
The tutorial series have been written in a step-by-step fashion. The code samples are well formatted with good indentation, making them very readable. There is no missing special character, as you would find in some other sites. The hyperlinks to the different parts of the series are easily accessible from the different pages of the series. The tutorial series is free. Click the following link to start the series: