title: PHP does not update file opened one time in page?
body: <p>(Sorry my bad english)<br>
  I tryed to create a script PHP that show the inicial content of the file, update it and show content updated.<br>
  I need this operations in this order.
  I already tryed fflush() before the fclose() but it does not worked.</p>
  
  <p>My expected result:<br>
  -When opened page<br>
  first:<br>
  second: 0<br>
  -When refresh page<br>
  first: 0<br>
  second: <strong>0 0</strong><br>
  -When refresh page again<br>
  first: 0 0<br>
  second: <strong>0 0 0</strong><br>
  -And so on.  </p>
  
  <p>My result is:<br>
  -When opened page<br>
  first:<br>
  second: 0<br>
  -When refresh page<br>
  first: 0<br>
  second: <strong>0</strong><br>
  -When refresh page again<br>
  first: 0 0<br>
  second: <strong>0 0</strong><br>
  -And so on.  </p>
  
  <p>Code:<br>
      
  
  <pre><code>$v = "";
  echo file_exists("teste");
  
  if (file_exists("teste")) {
    if (filesize("teste") != 0) {
      $f = fopen("teste", 'r');
      $v = fread($f, filesize("teste"));
      fclose($f);
      echo "first:" . $v;
    }
  }
  
  $f = fopen("teste", 'w');
  fwrite($f, $v);
  fwrite($f, "0 ");
  fclose($f);
  
  $f = fopen("teste", 'r');
  $v = fread($f, filesize("teste"));
  fclose($f);
  echo "&lt;br /&gt;";
  echo "second:". $v;
  ?&gt;
  </code></pre>
  
  <p>why? is there any solution?</p>