[thelist] PHP - get one directory from a path?
Stephen Rider
evolt_org at striderweb.com
Tue Dec 19 11:54:23 CST 2006
Hi --
I'm trying to figure out a straightforward way to set a PHP variable
to a particular directory in a path.
For example: I have http://www.example.com/main/something/inner/
index.php
The path can change, though. Specifically, the directory "something"
is arbitrary -- the script could be running in http://www.example.com/
main/whatever/inner/ and so forth.
When the script runs, I want to set a variable to = "something", or
whatever that directory name happens to be.
I know how to get the last directory name using dirname() and such,
but I can't figure out how to get the directory two levels up....
Any ideas? Thanks in advance!
Stephen Rider
More information about the thelist
mailing list