note 20851 added to function.pathinfo
| From: | kelson at pobox dot com | Date: | Thu, 18 Apr 2002 18:44:36 +0000 |
| Subject: | note 20851 added to function.pathinfo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29531@lists.php.net to get a copy of this message | ||
An optimized version of this function (no loops, no temporary variables) would be:
function doc_root($path) {
return str_repeat('../', substr_count($path, "/")-1);
}
Then call it the same way.
--
http://www.php.net/manual/en/function.pathinfo.php
http://master.php.net/manage/user-notes.php?action=edit+20851
http://master.php.net/manage/user-notes.php?action=delete+20851
http://master.php.net/manage/user-notes.php?action=reject+20851