PHP Directory Functions
We all know what is directory in computer system. we can also known as folder in commuter system.
Here, in this php tutorial we will learn how to create directory, delete directory and read files in directory using php functions.
PHP Directory Functions :
- mkdir() – used to create new directory.
- rmdir() – used to remove directory.
- opendir() – used to open directory.
- readdir() – used to read file of opened directory.
PHP mkdir() syntax : View Example
<?php
mkdir(“directory_name”);
?>
PHP rmdir() syntax : View Example
<?php
rmdir(“directory_name”);
?>
PHP opendir() syntax : View Example
<?php
$dir = opendir(“directory_name”);
?>
PHP readdir() syntax : View Example
<?php
$file=readdir(“directory_name”);
?>
We will learn all PHP directory function with an example in next php tutorial.