How has the use of register_globals changed in different PHP versions?

The use of register_globals has changed in different PHP versions due to security concerns. In older versions of PHP, register_globals was enabled by default, allowing user input to automatically create global variables. This posed a significant security risk as it could lead to vulnerabilities like injection attacks. In newer versions of PHP, starting from PHP 5.4, register_globals has been deprecated and removed due to these security concerns. It is recommended to explicitly define variables using $_GET, $_POST, or $_REQUEST superglobals instead.

// Explicitly define variables using $_GET, $_POST, or $_REQUEST superglobals
$variable = $_POST['variable'];