Unnamed
public text v1 · immutable<?php
error_reporting(E_ALL);
session_start();
//check if the counter is set and if not, initialize it
if(!isset($_SESSION['counter'])) {
$_SESSION['counter'] = 0;
}
//increment the session counter
$_SESSION['counter']++;
//display it
echo 'Session counter is '.$_SESSION['counter'];
?>