title: PHP Counter Using OOP
body: <p>I'm new to OOP terminology, I am trying to create a class that make a hit counter.</p>
  
  <p>I try the code below but it create just a counter.txt page with inside value 1. I dont know why its not incrementing.</p>
  
  <pre><code>class LOGFILE {
      public function READ($FileName) {
          $handle = fopen($FileName, 'r');
          $fread = file_get_contents($FileName);
          return $fread;
          fclose($handle);
      }
      public function WRITE($FileName, $FileData) {
          $handle = fopen($FileName, 'w');
          $FileData = $fread +1;
          fwrite($handle, $FileData);
          fclose($handle);
      }
  }
  $logfile = new LOGFILE();
  
  $logfile -&gt; WRITE("counter.txt",$FileData);
  
  echo $logfile -&gt; READ("counter.txt");
  </code></pre>