What is the correct syntax for setting session variables in PHP?

To set session variables in PHP, you need to start the session using session_start() and then use the $_SESSION superglobal array to assign values to specific keys. This allows you to store data that can be accessed across different pages during a user's session on the website.

<?php
session_start();

// Set session variables
$_SESSION['username'] = 'john_doe';
$_SESSION['email'] = 'john.doe@example.com';
?>