How can the PHP_SELF variable be accessed in PHP code?

The PHP_SELF variable can be accessed in PHP code by using the $_SERVER superglobal array. This variable contains the filename of the currently executing script, making it useful for self-referencing forms or links. To access the PHP_SELF variable, you can use $_SERVER['PHP_SELF'] in your PHP code.

$php_self = $_SERVER['PHP_SELF'];
echo $php_self;