F.10. Directory

FunctionReturnsDescription
opendir(string path)
mixedOpens a directory and returns a dir_handle.
dir(string directory)
objectDirectory class with properties handle and path, and methods read, rewind, and close.
closedir([resource dir_handle])
voidCloses directory connection identified by the dir_handle.
chroot(string directory)
boolChanges root directory.
chdir(string directory)
boolChanges the current directory.
getcwd(void)
mixedGets the current directory.
rewinddir([resource dir_handle])
voidRewinds dir_handle back to the start.
readdir([resource dir_handle])
stringReads directory entry from dir_handle.
glob(string pattern [, int flags])
arrayFinds pathnames matching a pattern.
scandir(string dir [, int sorting_order])
arrayLists files and directories inside the specified path.
dl(string extension_filename)
intLoads a PHP extension at runtime.

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.