All pastes #199915 Raw Edit

raptor

public text v1 · immutable
#199915 ·published 2006-10-12 20:42 UTC
rendered paste body
function mkpath($path)
   {
     $dirs=array();
     $path=preg_replace('/(\/){2,}|(\\\){1,}/','/',$path); //only forward-slash
     $dirs=explode("/",$path);
     $path="";

     foreach ($dirs as $element)
         {
           $path.=$element."/";
        echo "DEBUG PATH: $path";
           if(!is_dir($path))
             {
             if(!mkdir($path)){ echo "something was wrong at : ".$path; die(); return 0; }
             }
         }
     echo("<B>".$path."</B> successfully created");
   }