Log in

View Full Version : get current filename as variable


topvip
2006-10-18, 12:31 AM
Sometimes you need just the filename of the current script, without the path. This snippet does just that using the SCRIPT_NAME and explode function. <?
$currentFile = $_SERVER["SCRIPT_NAME"];
$parts = Explode('/', $currentFile);
$currentFile = $parts[count($parts) - 1];
?>