php create session variable code example
Example 1: session initialize php
session_start();
Example 2: destroy session php
<?php
session_start();
session_destroy();
unset($_SESSION['username']);
?>
Example 3: 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 4: create session in php
<?php
session_start();
$_SESSION["color"]= "blue";
$_SESSION["animal"]= "dog";
echo "The session variable are set up.";
?>
Example 5: php session variables
<?php
session_start();
$_SESSION['var'];
?>
Example 6: echo session
print_r($_SESSION);