How About this?
<?php
  $cnt_file 
'/tmp/'.basename(__FILE__).'.cnt';;
  
$fp fopen($cnt_file'a');
  
fwrite($fp,'.');
  
fclose($fp);
  
$num filesize($cnt_file);
  echo 
"File has been accessed $num times";
?>
Output
File has been accessed 9 times