How to get dir name

What I want to get hold of is the name of the dir that a php script has run within, say the script is called index.php and is running in a dir called test,  what I want to do is get the name test and store it in a variable. how is this done

thanks kieran
kplonkAsked:
Who is Participating?
 
lokeshvConnect With a Mentor Commented:
chekc Default variable


$SCRIPT_FILENAME  and parse it...

$chunks=explode("/",$SCRIPT_FILENAME);
$count=count($chunks)-1;
$dir_name=$chunks[$count];

Hope this helps..

Lk
0
 
andrivCommented:
Try:
echo dirname($REMOTE_SERVER);
0
 
andrivCommented:
I gave you wrong enviroment variable should be:

echo dirname($REMOTE_PATH);
0
 
kplonkAuthor Commented:
Lovley job, just a small chang to the code and i can do exactly what i want.
0
 
lokeshvCommented:
Thanks for A


Lk
0
All Courses

From novice to tech pro — start learning today.