note 62503 added to function.dirname
| From: | phpcomm-david at tulloh dot id dot au | Date: | Thu, 02 Mar 2006 05:41:27 +0000 |
| Subject: | note 62503 added to function.dirname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104669@lists.php.net to get a copy of this message | ||
This is dirty little trick to allow dirname() to work with paths with and without files.
basename($var.'a');
Some examples:
<?php
$var='/foo/bar/file';
basename($var) == '/foo/bar'
basename($var.'a') == '/foo/bar'
$var='/foo/bar/';
basename($var) == '/foo'
basename($var.'a') == '/foo/bar'
?>
----
Server IP: 203.16.234.20
Probable Submitter: 150.203.118.130
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.dirname.php
Edit -- http://master.php.net/note/edit/62503
Del: integrated -- http://master.php.net/note/delete/62503/integrated
Del: useless -- http://master.php.net/note/delete/62503/useless
Del: bad code -- http://master.php.net/note/delete/62503/bad+code
Del: spam -- http://master.php.net/note/delete/62503/spam
Del: non-english -- http://master.php.net/note/delete/62503/non-english
Del: in docs -- http://master.php.net/note/delete/62503/in+docs
Del: other reasons-- http://master.php.net/note/delete/62503
Reject -- http://master.php.net/note/reject/62503
Search -- http://master.php.net/manage/user-notes.php