PHP opendir() Function – Open Directory

Open Directory in PHP – opendir() Function

The opendir() function is used to open files from directory.

opendir() function syntax


$dir = opendir(“directory_name”);


opendir() function Example

Here, we use opendir() function to open directory “meera” and store in $dir variable, we use the $dir variable for read content of file in future.

Read files from directory using readdir() function and opendir() function.

Exmaple of readdir() in PHP

The output is :

PHP read directory

PHP readdir function example for read files from directory.

Leave a Reply

Your email address will not be published. Required fields are marked *

3 + 1 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">