What are the advantages of using the superglobal array $_SESSION over session_register and session_is_registered in PHP?

Using the superglobal array $_SESSION is preferred over session_register and session_is_registered in PHP because it is more secure, efficient, and easier to use. The $_SESSION array stores session variables that are accessible across different pages of a website, eliminating the need to explicitly register and check variables.

// Start the session
session_start();

// Set a session variable
$_SESSION['username'] = 'JohnDoe';

// Access the session variable on another page
session_start();
echo $_SESSION['username'];