hi
i'm a PHP beginner and i have this PHP code that increments a number:
<?php
$fp = fopen("/usr/local/counter.txt", "r+");
flock($fp, LOCK_EX);
$now = fgets($fp, 10);
$now = intval($now)+1;
fseek($fp, 0, SEEK_SET);
fputs($fp, "$now");
flock($fp, LOCK_UN);
fclose($fp);
?>
it works incrementing but i need the word "counter=" in front of the number when it's printed to the text file. i tried changing this line:
fputs($fp, "$now");
to:
fputs($fp, "counter=$now");
but it stopped the incrementing. anyone have any ideas? thanks!