Code: Select all
<?php
$path = $_SERVER["SCRIPT_NAME"];
$file = basename($path); // $file is set to "myfile.php"
$file = basename($path, ".php"); // $file is set to "myfile"
?>
Code: Select all
<?
$currentFile = $_SERVER["SCRIPT_NAME"];
$parts = Explode('/', $currentFile);
$parts = array_reverse($parts);
echo("Script is " . $parts[0]);
?>