PHP Function Reference

PHP streamWrapper mkdir() Method



The PHP streamWrapper::mkdir() method creates a directory. This method is called in response to mkdir() function.

Note: In order for the appropriate error message to be returned this method should not be defined if the wrapper does not support creating directories.

Syntax

public streamWrapper::mkdir(path, mode, options)

Parameters

path Required. Specify the directory URL to be created.
mode Required. Specify the mode (permission) passed to mkdir(), given as an octal value (starting with 0). The parameter consists of four numbers:
  • The first number is always zero (octal value)
  • The second number specifies permissions for the OWNER
  • The third number specifies permissions for the OWNER's USER GROUP
  • The fourth number specifies permissions for EVERYBODY ELSE
Possible values (to set multiple permissions, add up the following numbers):
  • 1 = execute permissions
  • 2 = write permissions
  • 4 = read permissions
options Required. Specify a bitwise mask of values, such as STREAM_MKDIR_RECURSIVE.

Return Value

Returns true on success or false on failure.

Exceptions

Emits E_WARNING if call to this method fails (i.e. not implemented).

Note: The streamWrapper::$context property is updated if a valid context is passed to the caller function.

❮ PHP Streams Reference