How can one prevent session variables from being overwritten by global variables in PHP?

To prevent session variables from being overwritten by global variables in PHP, you can use the `$_SESSION` superglobal array to store session variables separately from global variables. This ensures that session variables are not accidentally overwritten by global variables with the same name.

<?php
session_start();

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

// Use session variable
echo $_SESSION['username'];
?>