get the value of session inside the function on php code example
Example 1: session initialize php
session_start();
Example 2: create session in php
<?php
// Start the session
session_start();
// Set session variables
$_SESSION["color"]= "blue";
$_SESSION["animal"]= "dog";
echo "The session variable are set up.";
?>