Loading, please wait...

A to Z Full Forms and Acronyms

How to print the filename of the current executing PHP script in PHP | PHP program

Feb 28, 2022 PHP, 1891 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);
?>
A to Z Full Forms and Acronyms