function recursiveMkdir($path) { if (!file_exists($path)) { recursiveMkdir(dirname($path)); @mkdir($path, 0777); } }
function recursiveMkdir($strPath, $mode = 0777) { return is_dir($strPath) or recursiveMkdir(dirname($strPath), $mode) and mkdir($strPath, $mode); }
function recursiveMkdir($path) { if (!is_dir($path)) { // recurse, passing the parent directory so that it gets created // (note that dirname returns the parent directory of the last item of the path // regardless of whether the last item is a directory or a file) recursiveMkdir(dirname($path)); mkdir($path, 0770); // create directory // alternatively, if the above line doesn't work for you, you might want to try: // $oldumask = umask(0); // mkdir($path, 0755); // create directory // umask($oldumask); } }