How does session_start() initialize custom $_SESSION variables in PHP?

When using session_start() in PHP, custom $_SESSION variables can be initialized by assigning values to them directly after calling session_start(). This ensures that the variables are available throughout the session for storing and retrieving data specific to the user.

<?php
session_start();

// Initialize custom $_SESSION variables
$_SESSION['username'] = 'JohnDoe';
$_SESSION['email'] = 'johndoe@example.com';
$_SESSION['isLoggedIn'] = true;
?>