note 91222 deleted from function.realpath by danbrown
| From: | danbrown@php.net | Date: | Mon, 01 Jun 2009 12:57:34 +0000 |
| Subject: | note 91222 deleted from function.realpath by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156220@lists.php.net to get a copy of this message | ||
Note Submitter: singh206 at gmail dot com
----
to get the relative can't you just strip the root from the realpath?
$realpath = realpath(__FILE__);
$root = $_SERVER['DOCUMENT_ROOT'].'/';
$relative = str_replace($root, '', $realpath);
echo "realpath: $realpath<br />";
echo "relative: $relative<br />";
You could use a regex to limit the replacement to the first occurence.