How can session variables be filled immediately after accessing a GET parameter in PHP?

When accessing a GET parameter in PHP, we can immediately set the value of a session variable to the value of the GET parameter. This allows us to store the value for later use throughout the session. To achieve this, we can use the $_SESSION superglobal array to set the session variable value to the value of the GET parameter.

<?php
session_start();

if(isset($_GET['parameter'])){
    $_SESSION['session_variable'] = $_GET['parameter'];
}
?>