note 43809 deleted from function.mkdir by tomsommer

From: Date: Sun, 04 Jul 2004 22:09:09 +0000
Subject: note 43809 deleted from function.mkdir by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72547@lists.php.net to get a copy of this message
Note Submitter: soren_bonlokke@hotmail.com ---- With this script i managed to create all the folders in a path ex. path: foo/bar/quux this script will first create foo then bar in foo and the quux in foo/bar: <?php $path = $_REQUEST['path']; $bits = explode("/", $path); if(is_array($bits)) { $i = count($bits); while ($i >= 0 ) { array_reverse($bits); $rel_path[] = $bits[$i]; if(is_array($rel_path)) { $new_path = join("/", $rel_path); @mkdir("..$new_path"); } else{ $new_path = $rel_path; @mkdir("..$new_path"); } $i = $i - 1; } } else { mkdir($path); } echo "<br><p>Directory successfully created<p>"; ?>

« previous php.notes (#72547) next »