How to Create Auto Counter in PHP

In this article, you will learn How to Create Auto Counter in PHP.

counter.php

<?php
$fp=fopen("count.txt","r");
if(!($fp=fopen("count.txt","r")))
{
die('file not found');
}
else
{
$counter=(int)fread($fp,20);
fclose($fp);
$counter++;
echo "you are visitor no.".$counter;
$fp1=fopen("count.txt","w");
fwrite($fp1,$counter);
fclose($fp1);
}
?>

count.txt file will store the numbers.

How to Get Current Indian Time in PHP

Check on Facebook

Leave a Reply

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