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() attempts 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:for 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"); ?>