Last active
August 27, 2018 04:12
-
-
Save alphp/ec8c74d88793177029c35636ed5be680 to your computer and use it in GitHub Desktop.
Check if path exists (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
<?php | |
function path_check ($path, $mode = null) { | |
if (!is_dir($path)) { | |
if (!empty($mode)) { | |
if (is_file($path)) { | |
unlink($path); | |
} | |
return mkdir($path, $mode, true); | |
} | |
return false; | |
} else { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment