Forum Moderators: coopster

Message Too Old, No Replies

Efficiently Comparing File Modification Dates

         

ocon

4:10 am on Jun 26, 2013 (gmt 0)

10+ Year Member Top Contributors Of The Month



My scripts constantly have to compare the modification dates of two files. To make the script work I have to clear my cache in PHP each time. Is there a more efficient way to compare file modification dates than this?

<?php
clearstatcache();
if(filemtime('file1.html') > filemtime('file2.html')){}
?>

phranque

7:47 am on Jun 26, 2013 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Is there a more efficient way to compare file modification dates than this?

have you tried profiling this to see if it's actually a problem?

have you tried clearing the stat cache for the specific filenames to see if that improves anything significantly?