faqts : Computers : Programming : Languages : PHP : Common Problems : Files : Tips and Tricks : File Handling

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

getcwd - not the path, the directory!
getcwd - not the path, the directory!
getcwd - not the path, the directory!

Nov 26th, 2002 11:47
Peter Anania,


There are times during web desin, when what you want is the the 
current sub directory not the entire path. This simple script gets 
that for you. (This works in Windows, to make it work in Un*x reverse 
the slash.)

$a = getcwd();
$b = split('[\]',$b,1024);
$c = sizeof($c);
$c = $c - 1;
$current_sub_dir = $b[$c];