Skip to content

Instantly share code, notes, and snippets.

@elkarrde
Created September 25, 2014 14:29
Show Gist options
  • Save elkarrde/dd098d18b6fa747f84b1 to your computer and use it in GitHub Desktop.
Save elkarrde/dd098d18b6fa747f84b1 to your computer and use it in GitHub Desktop.
<?php
require_once('phpCounter.php');
?>
<html>
<head>
<title>phpCounter example</title>
</head>
<body>
<h1>Hi!</h1>
<p>
I was seen great many times! Exactly this much: <?=counter();?>!
</p>
</body>
</html>
<?php
/* phpCounter v.0.0.1 by Neven Falica (elkarrde@github/twitter) */
function counter() {
$counter_file = 'counter.data';
$counter = file_get_contents($counter_file);
file_put_contents($counter_file, ++$counter);
return $counter;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment