boolean mkdir(string directory, integer mode)
The mkdir function creates a new directory with the supplied name. Permissions will be
set based on the mode argument, which follows the same rules as chmod. On Windows the
mode argument is ignored. You can use the rmdir function to remove a directory.
<?
if(mkdir("myDir", 0777))
{
print("directory created");
}
else
{
print("directory cannot be created");
}
?>
integer opendir(string directory)
The opendir function requires a directory name and returns a directory handle. This
handle may be used by readdir, rewinddir, and closedir. The dir function described
above provides an alternative to this group of functions.
<?
// print the current directory in a table
print("<TABLE BORDER=\"1\">\n");
// create header row
print("
print("
print("
print("
// open directory
$myDirectory = opendir(".");
// get each entry
while($entryName = readdir($myDirectory))
{
print("
print("
print("<TD ALIGN=\"right\">");
print(filesize($entryName));
print("");
print("
}
// close directory
closedir($myDirectory);