What it does: Starts a session and increments a counter stored on the server. If the number goes up when you refresh, session storage and cookies are working.
Debugging: If it resets every time, check session save path permissions and cookie settings.
<?php
session_start();
if(!isset($_SESSION['counter'])) $_SESSION['counter']=0;
$_SESSION['counter']++;
echo "Counter: ".$_SESSION['counter'];
?>