Storing a Session Variable – PHP

When you want to store information in a session use $_SESSION – this is where you store and retrive session data .

Example

<?php
session_start();
$_SESSION[‘phpcodez_views’] = 1; // store data
echo $_SESSION[‘phpcodez_views’]; //retrieve data
?>

Leave a Reply

Your email address will not be published. Required fields are marked *