1

I have a loop

while (true) {
    $time = filemtime($file);
    echo date("Y m d H i s", $time) . PHP_EOL;
    sleep(3);
}

Then I change the file, and PHP doesn't see modification unless I restart the loop. After restart, PHP shows new mod date. How can I overcome this?

mevsme
  • 441
  • 5
  • 15
  • 1
    See note #2: https://www.php.net/manual/en/function.filemtime.php#refsect1-function.filemtime-notes – Sammitch Mar 26 '20 at 00:51

1 Answers1

1

Use clearstatcache() to clear chached vale for that file.

mevsme
  • 441
  • 5
  • 15