What is the correct order of operations for setting session name and starting a session in PHP?

When setting a session name and starting a session in PHP, it is important to set the session name before starting the session. This ensures that the session name is properly initialized before any session data is stored. The correct order of operations is to set the session name using session_name() function and then start the session using session_start() function.

<?php
// Set the session name
session_name("my_session");

// Start the session
session_start();

// Now you can access or set session variables
$_SESSION['username'] = 'john_doe';
?>