PHP Program to get the current file name

A computer file is a computer resource on a computer that stores data, information, picture, video, settings, or commands used with a computer program. In a graphical user interface, an operating system displays a file as an icon.


STEP 1: Use the basename($_SERVER['PHP_SELF']) to get the current file name.

STEP 2: Display the file name

PHP Source Code

$current_file_name = basename($_SERVER['PHP_SELF']);
echo $current_file_name."\n";