Last active
August 29, 2015 14:21
-
-
Save jackreichert/a7eda8f85c0d27954eaf to your computer and use it in GitHub Desktop.
Recursively make a directory in php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// helper method | |
function make_dir( $path, $permissions = 0777 ) { | |
return is_dir( $path ) || mkdir( $path, $permissions, true ); | |
} | |
// for use inline | |
if ( ! file_exists( $path ) ) { | |
mkdir( $path, 0777, true ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment