Parsing back directories to DOCUMENT_ROOT?
| From: | The Doctor What | Date: | Sun, 04 Jun 2000 11:51:55 +0000 |
| Subject: | Parsing back directories to DOCUMENT_ROOT? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-970@lists.php.net to get a copy of this message | ||
Does anyone have a nice snippet of code to parse back up a directory
tree (like doing a 'cd ..; pwd' but without changing directory)?
I have a function that generates a sort of backtrace up a directory
tree:
Home -> Software -> PHP -> My PHP Example
It would generate this automagically. I have code that works, but
the URLs it generates are hideous:
/software/php/../../ for home, as an example.
I'm using explode, which presents other problems, like multiple
'/'s causing it to act weird.
I figured *someone* must have done something like this.
Thanks.
Ciao!
--
It has just been discovered that research causes cancer in rats.
The Doctor What: A Holtje Production http://docwhat.gerf.org/
docwhat@gerf.org KF6VNC