note 23718 deleted from function.substr-count by dams
| From: | dams@php.net | Date: | Sat, 27 Jul 2002 16:21:32 +0000 |
| Subject: | note 23718 deleted from function.substr-count by dams | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-33664@lists.php.net to get a copy of this message | ||
I was tryin to find a way to find relative path back to Doc Root to post pictures form one script
called form multiple pages in a site, so I wrote this. A little bit clumsy but works:
$callfrom=$PHP_SELF; // included in file calling the script before an include command
$count=substr_count ($callfrom, '/');
$pathtoroot='';
$x=1;
while ($x<$count){$pathtoroot='../'.$pathtoroot;$x=++$x;}
EG if the calling document was whatver.com/foo/bar/php/index.php then the $roottopath = ../../../