Possible Duplicate:
PHP Get name of current directory
Today I tried to get the folder name of a directory. I was successful to an extent. But it did not meet my criteria. The code which I have is as follows.
<?php
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : $_SERVER['REQUEST_URI'];
$foldername = basename($url);
echo $foldername;
?>
This returns the final value in an URL. I mean if the URL is localhost/default
it returns default
and when the url is localhost/default/index.php
it returns index.php
. I want it to return default
in both the cases.
So is it possible to get the thing which I am expecting ?? Please help me out with that..