<?
function GetFileDir($php_self){
$filename = explode("/", $php_self); // THIS WILL BREAK DOWN THE PATH INTO AN ARRAY
for( $i = 0; $i < (count($filename) - 1); ++$i ) {
$filename2 .= $filename[$i].'/';
}
return $filename2;
}
echo GetFileDir($_SERVER['PHP_SELF']);
?>
function GetFileDir($php_self){
$filename = explode("/", $php_self); // THIS WILL BREAK DOWN THE PATH INTO AN ARRAY
for( $i = 0; $i < (count($filename) - 1); ++$i ) {
$filename2 .= $filename[$i].'/';
}
return $filename2;
}
echo GetFileDir($_SERVER['PHP_SELF']);
?>
so for example when i do this:
echo $_SERVER['PHP_SELF'];
OUTPUT:
/var/www/myfile.php
but i dont want the myfile.php part of it, i only need /var/www/ part. so to do this you can use the function above and it will return this:
OUTPUT:
/var/www/
thanks for www.webune.com for their support on this.