PHP Directory Functions Reference Guide

This reference page provides a comprehensive, alphabetical catalog of all built-in Directory Functions in PHP. In modern web development and university exams (BCA, BSc CS, B.Tech), understanding these core functions accelerates programming speed and prevents you from reinventing existing standard library tools.

Quick Tip: In modern PHP 8, you can use named arguments to specify parameters without having to memorize optional default argument positions!

Function

Description

chdir()

Changes the current directory

chroot()

Changes the root directory

closedir()

Closes a directory handle

dir()

Returns an instance of the Directory class

getcwd()

Returns the current working directory

opendir()

Opens a directory handle

readdir()

Returns an entry from a directory handle

rewinddir()

Resets a directory handle

scandir()

Returns an array of files and directories of a specified directory

Related Reference Links & Tutorials

For in-depth practical tutorials and student code examples, explore these related classes:

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!