PHP mkdir() Function
Definition and Usage
mkdir() function creates a directory.
If successful, returns true, otherwise returns false.
Syntax
mkdir(path,mode,recursive,context)
Parameters | Description |
---|---|
path | required. Specifies the name of the directory to be created. |
mode | required. Specifies the permissions. The default is 0777. |
recursive | required. Specifies whether to set the recursive mode. |
context | required. Specifies the environment of the file handle. Context is a set of options that modify the behavior of the writable stream. |
Description
mkdir() tries to create a directory named by path the specified directory.
default mode is 0777, meaning the maximum possible access rights.
Tips and Comments
Note:mode is ignored under Windows. It has been an option since PHP 4.2.0.
Note:to context Support for is added in PHP 5.0.0.
Note:recursive The parameter was added in PHP 5.0.0.
Example
<?php mkdir("testing"); ?>