<?php
// If it's the user's first visit set the count to 1
if(!$_COOKIE["pageCounter"]) $count = 1;

// If they've been here before, then add 1 to their visit count
else $count = $_COOKIE["pageCounter"] + 1;

// Make a year-long cookie that whose starts at 1or replace the old one with the current count
setcookie("pageCounter", "$count", time()+60*60*24*365);

echo "<p>You've viewed this page " . $count . " times.</p>";
?>