note 20512 added to function.pathinfo
| From: | shawn at asheville dot com | Date: | Sat, 06 Apr 2002 02:30:58 +0000 |
| Subject: | note 20512 added to function.pathinfo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28687@lists.php.net to get a copy of this message | ||
well see, not to say that anyone here is wrong, but i couldn't get any of the examples to work
correctly when the function was used in the document root. using pathinfo() $pathinfo[dirname] would
return $deep as 1 whether it was used in / or /somedir/. so, i rewrote the first one into this:
function doc_root($path) {
$deep = substr_count($path, "/");
for($i = 1; $i < $deep; $i++) {
$document_root .= "../";
}
return $document_root;
}
$document_root=doc_root($REQUEST_URI);
now the function works because pathinfo() isn't used.
Shawn Lawyer
--
http://www.php.net/manual/en/function.pathinfo.php
http://master.php.net/manage/user-notes.php?action=edit+20512
http://master.php.net/manage/user-notes.php?action=delete+20512
http://master.php.net/manage/user-notes.php?action=reject+20512