How can the PHP code be improved to prevent manipulation of the PHP_SELF variable?

To prevent manipulation of the PHP_SELF variable, it is recommended to use the $_SERVER['SCRIPT_NAME'] or $_SERVER['PHP_SELF'] instead of relying on the PHP_SELF variable. This helps to ensure that the variable is not tampered with by external sources and provides a more secure way to access the current script name.

$current_script = $_SERVER['SCRIPT_NAME'];
// Alternatively, you can also use:
// $current_script = $_SERVER['PHP_SELF'];

echo "Current script: " . $current_script;