PHP mkdir() Function

The mkdir() function creates a directory.Returns TRUE on success or FALSE on failure.

bool mkdir ( string $pathname [, int $mode = 0777 [, bool $recursive = FALSE [, resource $context ]]] )

Attempts to create the directory specified by pathname.

Example -

Example -

ParameterDescription
pathnameThe directory path.
modeThe mode is 0777 by default, which means the widest possible access. For more information on modes, read the details on the chmod() page.
recursiveAllows the creation of nested directories specified in the pathname.
contextSpecifies the context of the file handle. Context is a set of options that can modify the behavior of a stream (added in PHP 5)