How can you efficiently assign multiple session variables in PHP without using session_register()?

Using session_register() is deprecated in PHP, so a more efficient way to assign multiple session variables is by directly accessing the $_SESSION superglobal array. You can simply assign values to specific keys in the $_SESSION array to set session variables.

<?php
session_start();

$_SESSION['username'] = 'john_doe';
$_SESSION['email'] = 'john.doe@example.com';
$_SESSION['role'] = 'admin';
?>