doing filemtime after fopen / fwrite / fclose
am 04.09.2007 02:28:31 von yawnmothSay I have the following script:
$timestamp = filemtime("test.txt");
echo 'original file time
'.$timestamp.'
';
$fp = fopen("test.txt",'w');
fputs($fp,$data);
fclose($fp);
$timestamp = filemtime("test.txt");
echo 'new file time
'.$timestamp.'
';
echo 'current time
'.time();
?>
When I run it, once, I get this as the output:
original file time
1188864270
new file time
1188864270
current time
1188864484
When I run it again, I get this as the output:
original file time
1188864484
new file time
1188864484
current time
1188864999
Basically, the combination of fopen / fwrite / fclose changes the file
modification time, as evidenced by the second execution of the PHP
script. filemtime, however, does not catch the updated file
modificatoin time when it's ran in the same script.
Any ideas as to why?