create session variable php code example
Example 1: session initialize php
session_start();
Example 2: set php varibianle session
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
$_SESSION["color"]= "blue";
$_SESSION["animal"]= "dog";
echo "The session variable are set up.";
?>
</body>
</html>
Example 3: php session variables
<?php
session_start();
$_SESSION['var'];
?>
Example 4: $_SESSION php example
<?php
session_start();
echo session_id();
?>
Example 5: session start php
<?php
session_start([
'cookie_lifetime' => 86400,
]);
?>