Sometimes there is a need to show the name of the current file.
Using $_SERVER[‘PHP_SELF’] will only show the file that is executed (not the a included file)
Using __FILE__ gives the current file (with a full path)
For this example running.php is accessed in the browser/cli.
//included.php <?php echo $_SERVER['PHP_SELF']; //will show running.php echo __FILE__; //will show included.php ?> //running.php <?php INCLUDE('included.php') ?> |