örneğin sayac.php sayfası olsun bu. Bu sayfayı 24 saatte bir kere çalıştırmak için en basitinden bir cronjob a koyun.
$startingValue = 56785;

if (!file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'sayac.json')) {
    $data = [
        'value' => $startingValue,
        'lastModified' => time()
    ];
} else {
    $file = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'sayac.json');
    $decode= json_decode($file, true);
    $data = [
        'value' => $decode['value'] + 1,
        'lastModified' => time()
    ];
}
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . 'sayac.json', json_encode($data));
Bu da değişkeni kullanacağınız örneğin index.php dosyası olsun
$file = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'sayac.json');
$decode = json_decode($file, true);
$variable = $decode['value'];
$lastModified = $decode['lastModified']; // Son değiştirilme zamanını almak isterseniz diye