I just used an easy way to blow up a line and rebuild and check if the file or directory is
public function mkdirRecursive($path) { $str = explode(DIRECTORY_SEPARATOR, $path); $dir = ''; foreach ($str as $part) { $dir .= DIRECTORY_SEPARATOR. $part ; if (!is_dir($dir) && strlen($dir) > 0 && strpos($dir, ".") == false) { mkdir($dir , 655); }elseif(!file_exists($dir) && strpos($dir, ".") !== false){ touch($dir); } } }
source share