Initiate session and create a few session variables
<?php
// Initiate session and create a few session variables
session_start();
// Set the variables. These could be set via an HTML form, for example.
$_SESSION['username'] = "joe";
$_SESSION['loggedon'] = date("M d Y H:i:s");
// Encode all session data into a single string and return the result
$sessionVars = session_encode();
echo $sessionVars;
?>
Related examples in the same category