3v4l.org

run code in 300+ PHP versions simultaneously
<?php // doesn't update realpath cache touch('foo'); var_dump(filemtime('foo')); touch('foo', 1); var_dump(filemtime('foo')); // does update the realpath cache touch('file:///tmp/foo'); var_dump(filemtime('file:///tmp/foo')); touch('file:///tmp/foo', 1); var_dump(filemtime('file:///tmp/foo'));
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.32, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Warning: touch(): open_basedir restriction in effect. File(foo) is not within the allowed path(s): (/tmp:/in:/etc) in /in/YEAOW on line 5 Warning: filemtime(): open_basedir restriction in effect. File(foo) is not within the allowed path(s): (/tmp:/in:/etc) in /in/YEAOW on line 6 bool(false) Warning: touch(): open_basedir restriction in effect. File(foo) is not within the allowed path(s): (/tmp:/in:/etc) in /in/YEAOW on line 7 Warning: filemtime(): open_basedir restriction in effect. File(foo) is not within the allowed path(s): (/tmp:/in:/etc) in /in/YEAOW on line 8 bool(false) int(1469202619) int(1469202619)
Output for 7.4.33
Warning: touch(): Unable to create file foo because Read-only file system in /in/YEAOW on line 5 Warning: filemtime(): stat failed for foo in /in/YEAOW on line 6 bool(false) Warning: touch(): Unable to create file foo because Read-only file system in /in/YEAOW on line 7 Warning: filemtime(): stat failed for foo in /in/YEAOW on line 8 bool(false) int(1469202619) int(1469202619)

preferences:
225.57 ms | 402 KiB | 302 Q