title: PHP file access time not updating as expected
body: <p>I am writing to a log file in PHP.  </p>
  
  <p>If it has only been a few seconds since last <code>fwrite</code>, I wish to append to the log file; if more than 10 seconds, it is a new test and the <code>fopen</code> context should be 'w' (overwrite).</p>
  
  <p>This was my plan:</p>
  
  <pre><code>$ff = '_ax_test.log';
  $wm = (time() - filemtime($ff) &gt;= 10) ? 'w': 'a'; //write mode (append or write)
  $fp=fopen($ff, $wm);
  </code></pre>
  
  <p>However, the results are unexpected -- $wm evaluates always > 10, always. Even for immediately subsequent writes.</p>
  
  <p>As a test, I left the file alone for several minutes, and then ran this TWICE, with a 90-second break in between:</p>
  
  <pre><code>$ff = '_ax_test.log';
  $tt = time();
  $ft = filemtime($ff);
  $dd = $tt - $ft;
  $wm = ($dd &lt;= 500) ? 'a': 'w'; //write mode (append or write)
  
  $fp=fopen($ff, 'w');
  fwrite($fp, 'First write: ' .$wm. '   ('.$dd.' = tt:[' .$tt. '] - ft[' .$ft. '] )' ."\n\r"); 
  fclose($fp);
  
  sleep(6);
  
  $ff = '_ax_test.log';
  $tt = time();
  $ft = filemtime($ff);
  $dd = $tt - $ft;
  $wm = ($dd &lt;= 500) ? 'a': 'w'; //write mode (append or write)
  
  $fp=fopen($ff, 'w');
  fwrite($fp, 'First write: ' .$wm. '   ('.$dd.' = tt:[' .$tt. '] - ft[' .$ft. '] )' ."\n\r"); 
  fclose($fp);
  </code></pre>
  
  <p><strong>Result:</strong></p>
  
  <pre><code>First write: a   (318 = tt:[1422045622] - ft[1422045304] )
  
  Next write: a   (324 = tt:[1422045628] - ft[1422045304] )
  
  ---- 90-second delay ----
  
  First write: a   (94 = tt:[1422045722] - ft[1422045628] )
  
  Next write: a   (100 = tt:[1422045728] - ft[1422045628] )
  </code></pre>
  
  <p>There is exactly a 6-second delay between the first and second fwrites, but the filetime on the file doesn't seem to change when it should.</p>
  
  <p>Am I missing something obvious?</p>