How to print the filename of the current executing PHP script in PHP | PHP program
Jun 24, 2021
PHP,
255 Views
How to print the filename of the current executing PHP script in PHP | PHP program
How to print the filename of the current executing PHP script in PHP | PHP program
We will use $_SERVER['PHP_SELF'] superglobal to get the name of the currently executing file and print that on the webpage.
<?php
$fileName = $_SERVER['PHP_SELF'];
printf("File Name: %s<br>", $fileName);
?>