$var = explode("/",$_SERVER['PHP_SELF']); //print_r($var); $count = count((array)$var); $pagename = $var[$count-1]; //index.php ?>