Is using $_SERVER['PHP_SELF'] a more reliable method than defining $PHP_SELF in PHP scripts?

Using $_SERVER['PHP_SELF'] is generally considered a more reliable method than defining $PHP_SELF in PHP scripts. This is because $_SERVER['PHP_SELF'] is a predefined variable that contains the filename of the currently executing script. It provides a consistent way to access the script's filename across different server configurations and environments.

$current_script = $_SERVER['PHP_SELF'];
echo "The current script is: $current_script";