store id values in session php code example
Example 1: php session regenerate id
<?php
session_start();
$old_sessionid = session_id();
session_regenerate_id();
$new_sessionid = session_id();
echo "Old Session: $old_sessionid<br />";
echo "New Session: $new_sessionid<br />";
?>
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: session start php
<?php
session_start([
'cookie_lifetime' => 86400,
]);
?>