The PHP function mkdir() is used to create a new directory. It takes two parameters: the path of the folder to create, and a numeric value representing the permissions of the directory.
Example 1:
This code checks if the folder already exists using the file_exists() function. If it does not exist, then it creates the folder. The third parameter of mkdir() function is set to true to create any subdirectories that are necessary. The 0777 value sets the permission level of the folder to be readable, writable and executable by everyone.
Example 2:
This code sets the umask to 0 in order to grant full permissions to the folder created. The mkdir() function is then used to create the folder with 0777 permission level.
Package library: PHP Filesystem.
PHP folder::create - 7 examples found. These are the top rated real world PHP examples of folder::create extracted from open source projects. You can rate examples to help us improve the quality of examples.