How to use opendir in PHP Directory

In this article I am going to explain about opendir function in PHP.
  • 1881

PHP opendir() function

The directory opendir function open the directory handle.

Syntax of  opendir function

opendir(directorypath, context)

Parameters in opendir function

It have two parameter:

Parameter Description
directorypath It specifies the directory to stream.
context It specifies the context of the directory handle.

Example of directory opendir  function




$dir = opendir("C:\wamp\www\Dinesh");

while (($file = readdir($dir)) !== false)


  echo "filename: " . $file . "<br />";







opendir function.jpg

You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.