3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function inRange($x, $a, $b) { return ($x >= $a && $x <= $b) ? "YES" : "NO"; } // No args $now = time(); touch("/tmp/test0"); $fileInfo = new SplFileInfo("/tmp/test0"); print(inRange($fileInfo->getATime(), $now, $now + 10)."\n"); print(inRange($fileInfo->getMTime(), $now, $now + 10)."\n"); // Mofification time only touch("/tmp/test1", strtotime("2005-10-15")); $fileInfo = new SplFileInfo("/tmp/test1"); print($fileInfo->getATime()."\n"); print($fileInfo->getMTime()."\n"); // Modification and access time touch("/tmp/test2", strtotime("2005-10-15"), strtotime("2010-10-15")); $fileInfo = new SplFileInfo("/tmp/test2"); print($fileInfo->getATime()."\n"); print($fileInfo->getMTime()."\n");
based on 5aeLu
Output for 5.1.2 - 7.1.0
NO NO 1129327200 1129327200 1287093600 1129327200
Output for 5.0.0 - 5.1.1
Fatal error: Class 'SplFileInfo' not found in /in/blOKT on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: splfileinfo in /in/blOKT on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: splfileinfo in /in/blOKT on line 10