note 9652 added to str_repeat
| From: | gabor at millgate dot fi | Date: | Thu, 16 Nov 2000 22:34:09 +0000 |
| Subject: | note 9652 added to str_repeat | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7791@lists.php.net to get a copy of this message | ||
You may find this code fragment useful if you want to calculate the relative path from your PHP file
to the top level:
$path_up = str_repeat("../",substr_count($PHP_SELF,"/")-1);
Note that $PHP_SELF will contain at least one "/" character (which is practically the top
level itself).
http://www.php.net/manual/function.str-repeat.php