PHP mkdir()Functions
Complete PHP Filesystem Reference Manual
Definition and Usage
The mkdir() function creates a directory.
This function returns TRUE on success, or FALSE on failure.
Syntax
mkdir(path,mode,recursive,context)
| Parameters | Description |
|---|---|
| path | Required. Specifies the name of the directory to create. |
| mode | Optional. Specifies permissions. Default is 0777 (allows global access). The mode parameter consists of four numbers:
Possible values (to set multiple permissions, add the numbers below together):
|
| recursive | Optional. Specifies whether to set recursive mode. (Added in PHP 5) |
| context | Optional. Specifies the environment of the file handle. context is a set of options that can modify the behavior of the stream. (Added in PHP 5) |
Tips and Notes
Note:The mode parameter is ignored on Windows platforms.
Examples
<?php
mkdir("testing");
?>
mkdir("testing");
?>
Complete PHP Filesystem Reference Manual Other Extensions