What is the difference between using session_register() and $_SESSION Global in PHP?

The main difference between using session_register() and $_SESSION Global in PHP is that session_register() is deprecated as of PHP 5.3.0 and removed in PHP 5.4.0, while $_SESSION Global is the recommended way to work with session variables. Using $_SESSION Global is more secure and reliable as it directly accesses the session data stored on the server.

// Using $_SESSION Global to set a session variable
session_start();
$_SESSION['username'] = 'JohnDoe';