Welcome to WebmasterWorld Guest from 54.156.37.174

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Efficiently Comparing File Modification Dates

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

Full Member

5+ Year Member Top Contributors Of The Month

joined:Sept 30, 2009
posts:227
votes: 1


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')){}
?>
7:47 am on June 26, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11236
votes: 126


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?