Skip to content

Instantly share code, notes, and snippets.

@adam-vessey
Last active March 10, 2016 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adam-vessey/386494830670a19e0f97 to your computer and use it in GitHub Desktop.
Save adam-vessey/386494830670a19e0f97 to your computer and use it in GitHub Desktop.
<?php
$dir = '/tmp';
$file = "$dir/alpha";
file_put_contents($file, 'test');
$stat_one = stat($file);
file_put_contents($file, 'test_string');
$stat_two = stat($file);
clearstatcache(TRUE, $file);
$stat_three = stat($file);
print('Should contain "size", however:');
print_r(array_diff_assoc($stat_one, $stat_two));
print('After clearing the stat cache:');
print_r(array_diff_assoc($stat_one, $stat_three));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment