note 77725 added to function.mkdir
| From: | ZingusJ dot Rinkle at osu1 dot php dot net | Date: | Mon, 10 Sep 2007 18:28:03 +0000 |
| Subject: | note 77725 added to function.mkdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130346@lists.php.net to get a copy of this message | ||
Most mkpath() function I saw listed here seem long and convoluted.
Here's mine:
<?php
function mkpath($path)
{
if(@mkdir($path) or file_exists($path)) return true;
return (mkpath(dirname($path)) and mkdir($path));
}
?>
Untested on windows, but dirname() manual says it should work.
----
Server IP: 208.69.120.35
Probable Submitter: 67.159.44.138
----
Manual Page -- http://www.php.net/manual/en/function.mkdir.php
Edit -- https://master.php.net/note/edit/77725
Del: integrated -- https://master.php.net/note/delete/77725/integrated
Del: useless -- https://master.php.net/note/delete/77725/useless
Del: bad code -- https://master.php.net/note/delete/77725/bad+code
Del: spam -- https://master.php.net/note/delete/77725/spam
Del: non-english -- https://master.php.net/note/delete/77725/non-english
Del: in docs -- https://master.php.net/note/delete/77725/in+docs
Del: other reasons-- https://master.php.net/note/delete/77725
Reject -- https://master.php.net/note/reject/77725
Search -- https://master.php.net/manage/user-notes.php