3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * test that filemtime() returns Unix timestamp (UTC) on current system */ $nowHour = isset($_SERVER['REQUEST_TIME']) ? $_SERVER['REQUEST_TIME'] : time(); $hostname = php_uname('n'); $formatRfc = 'D, d M Y H:i:s O'; $timestampStartOfUnixEpoch = 0; // start of the Unix epoch. $timestampRequest = 3600 * (int)($nowHour / 3600); $tempDir = function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : '/tmp'; $testFile = sprintf('%s/%s', $tempDir, 'test-filemtime'); if ($hostname !== 'php_shell') { printf("PHP version is %s and OS is %s\n", PHP_VERSION, PHP_OS); } printf("Testfile is '%s'.\n", $testFile); touch($testFile, $timestampStartOfUnixEpoch); php_clearstatcache(false, $testFile); $mtime = filemtime($testFile); printf("Testfile '%s' mtime should be from touch %d, is %d.\n", basename($testFile), $timestampStartOfUnixEpoch, $mtime); printf("The mtime represents %s\n", date($formatRfc, $mtime)); touch($testFile, $timestampRequest); php_clearstatcache(false, $testFile); $mtime = filemtime($testFile); printf("Testfile '%s' mtime should be from touch %d, is %d.\n", basename($testFile), $timestampRequest, $mtime); printf("The mtime represents %s\n", date($formatRfc, $mtime)); unlink($testFile); /** * @param $clear_realpath_cache * @param $filename * @link http://php.net/manual/en/function.version-compare.php */ function php_clearstatcache($clear_realpath_cache, $filename) { if (version_compare(PHP_VERSION, '5.3.0') >= 0) { clearstatcache($clear_realpath_cache, $filename); } else { clearstatcache(); } }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.4.10.0100.00715.34
7.4.00.0090.00915.11
7.3.130.0060.01015.15
7.3.120.0040.01515.02
7.3.110.0030.01015.18
7.3.100.0070.00715.07
7.3.90.0030.00914.95
7.3.80.0070.00715.23
7.3.70.0060.00615.01
7.3.60.0120.00315.09
7.3.50.0000.00914.95
7.3.40.0140.00015.14
7.3.30.0030.00915.15
7.3.20.0060.00316.96
7.3.10.0070.00816.85
7.3.00.0050.01016.80
7.2.260.0090.00615.12
7.2.250.0070.01115.25
7.2.240.0070.01015.32
7.2.230.0040.01115.14
7.2.220.0060.01215.14
7.2.210.0040.01115.10
7.2.200.0030.01015.35
7.2.190.0090.00615.00
7.2.180.0070.00715.34
7.2.170.0060.01114.89
7.2.160.0040.01115.22
7.2.150.0090.00616.98
7.2.140.0090.00317.20
7.2.130.0060.00717.05
7.2.120.0070.00517.04
7.2.110.0010.01217.06
7.2.100.0060.00917.03
7.2.90.0050.00817.02
7.2.80.0060.00617.05
7.2.70.0040.00917.06
7.2.60.0050.00917.04
7.2.50.0090.00517.04
7.2.40.0070.00417.15
7.2.30.0070.01016.90
7.2.20.0070.00617.03
7.2.10.0050.00917.01
7.2.00.0070.00717.09
7.1.330.0000.01615.66
7.1.320.0100.00315.70
7.1.310.0040.00415.96
7.1.300.0030.00715.63
7.1.290.0000.00816.08
7.1.280.0090.00615.81
7.1.270.0040.01115.83
7.1.260.0000.00815.82
7.1.250.0040.00915.89
7.1.240.0050.00615.79
7.1.230.0080.00715.92
7.1.220.0030.00515.87
7.1.210.0050.00915.97
7.1.200.0050.00616.00
7.1.190.0040.00915.91
7.1.180.0050.00615.71
7.1.170.0050.00715.99
7.1.160.0100.00715.64
7.1.150.0040.00915.87
7.1.140.0080.00816.01
7.1.130.0060.00415.84
7.1.120.0080.00515.94
7.1.110.0050.00815.69
7.1.100.0020.01115.82
7.1.90.0060.00816.04
7.1.80.0060.00715.95
7.1.70.0040.00516.36
7.1.60.0060.01117.06
7.1.50.0020.01216.30
7.1.40.0100.00315.80
7.1.30.0030.01016.06
7.1.20.0060.00815.97
7.1.10.0030.01015.73
7.1.00.0050.03117.89
7.0.330.0090.00415.38
7.0.320.0040.00915.54
7.0.310.0060.00515.40
7.0.300.0060.00415.33
7.0.290.0070.00715.44
7.0.280.0070.00415.43
7.0.270.0030.00815.47
7.0.260.0050.00915.35
7.0.250.0030.00815.47
7.0.240.0060.00815.62
7.0.230.0040.01015.68
7.0.220.0050.00815.44
7.0.210.0100.00415.53
7.0.200.0020.00815.91
7.0.190.0040.00815.54
7.0.180.0040.00915.51
7.0.170.0030.00815.27
7.0.160.0040.00515.55
7.0.150.0070.00515.48
7.0.140.0060.02817.62
7.0.130.0030.01215.56
7.0.120.0050.00815.41
7.0.110.0060.00715.36
7.0.100.0100.03117.06
7.0.90.0030.02916.99
7.0.80.0060.02617.01
7.0.70.0100.03017.04
7.0.60.0050.02616.87
7.0.50.0150.02617.13
7.0.40.0090.02515.77
7.0.30.0070.01715.66
7.0.20.0090.01915.83
7.0.10.0090.03115.67
7.0.00.0030.03615.73
5.6.400.0100.00614.74
5.6.390.0040.00814.57
5.6.380.0060.00914.43
5.6.370.0060.00614.39
5.6.360.0050.00714.61
5.6.350.0050.00614.39
5.6.340.0050.00914.54
5.6.330.0060.01014.38
5.6.320.0080.00214.44
5.6.310.0040.00914.46
5.6.300.0030.01014.50
5.6.290.0050.00914.63
5.6.280.0050.02816.69
5.6.270.0060.00414.54
5.6.260.0050.00914.54
5.6.250.0070.03216.61
5.6.240.0060.02216.63
5.6.230.0110.02616.53
5.6.220.0070.02616.46
5.6.210.0040.02616.55
5.6.200.0090.01616.66
5.6.190.0110.03016.61
5.6.180.0090.02116.71
5.6.170.0040.03016.67
5.6.160.0100.01716.59
5.6.150.0090.02816.72
5.6.140.0060.03216.71
5.6.130.0060.03316.71
5.6.120.0070.02916.61
5.6.110.0120.02316.81
5.6.100.0060.02816.75
5.6.90.0040.02716.53
5.6.80.0080.02916.35
5.6.70.0030.02316.39
5.6.60.0050.01916.47
5.6.50.0070.02816.47
5.6.40.0100.02616.36
5.6.30.0040.03216.40
5.6.20.0100.02616.42
5.6.10.0030.02116.35
5.6.00.0040.03516.38
5.5.380.0050.02215.47
5.5.370.0100.01915.26
5.5.360.0080.02715.32
5.5.350.0100.03015.37
5.5.340.0050.02215.47
5.5.330.0020.02415.53
5.5.320.0010.03315.39
5.5.310.0050.01815.55
5.5.300.0100.02415.43
5.5.290.0010.02815.36
5.5.280.0050.02415.55
5.5.270.0030.03115.52
5.5.260.0080.02915.65
5.5.250.0040.02215.47
5.5.240.0030.02115.40
5.5.230.0040.02315.30
5.5.220.0030.03315.29
5.5.210.0040.02815.27
5.5.200.0050.03015.32
5.5.190.0060.03015.30
5.5.180.0090.02815.31
5.5.170.0050.01012.82
5.5.160.0080.01715.31
5.5.150.0110.02615.26
5.5.140.0020.02515.28
5.5.130.0060.03215.36
5.5.120.0040.02115.18
5.5.110.0040.03115.27
5.5.100.0070.02715.19
5.5.90.0040.01915.25
5.5.80.0040.02815.23
5.5.70.0040.02415.22
5.5.60.0070.03015.10
5.5.50.0070.03215.27
5.5.40.0100.02315.15
5.5.30.0030.01915.16
5.5.20.0090.02215.20
5.5.10.0060.03015.08
5.5.00.0020.01915.14
5.4.450.0070.01913.93
5.4.440.0040.02413.91
5.4.430.0080.03114.02
5.4.420.0080.01613.88
5.4.410.0100.03113.89
5.4.400.0040.02713.77
5.4.390.0030.02213.74
5.4.380.0010.01913.79
5.4.370.0010.03213.84
5.4.360.0050.02913.86
5.4.350.0020.01913.76
5.4.340.0070.02613.61
5.4.330.0050.00611.04
5.4.320.0080.02913.72
5.4.310.0040.01913.89
5.4.300.0020.02513.83
5.4.290.0050.01713.75
5.4.280.0050.02813.70
5.4.270.0040.01813.87
5.4.260.0050.01713.83
5.4.250.0050.02913.87
5.4.240.0030.02913.82
5.4.230.0080.02713.88
5.4.220.0060.02213.72
5.4.210.0050.02813.65
5.4.200.0050.03013.75
5.4.190.0060.02813.79
5.4.180.0070.01413.73
5.4.170.0040.01713.88
5.4.160.0040.02813.86
5.4.150.0010.02313.79
5.4.140.0050.02012.99
5.4.130.0040.02812.96
5.4.120.0040.01612.78
5.4.110.0070.01812.93
5.4.100.0070.02713.02
5.4.90.0030.02212.94
5.4.80.0040.03112.93
5.4.70.0050.02113.07
5.4.60.0080.02612.85
5.4.50.0070.02712.94
5.4.40.0020.01912.93
5.4.30.0060.01712.78
5.4.20.0040.02412.85
5.4.10.0070.02212.99
5.4.00.0030.02812.81
5.3.290.0070.03812.96
5.3.280.0100.03812.89
5.3.270.0030.03012.96
5.3.260.0050.02712.93
5.3.250.0070.03512.93
5.3.240.0070.01812.90
5.3.230.0040.03112.86
5.3.220.0030.04212.85
5.3.210.0020.04512.84
5.3.200.0070.01812.87
5.3.190.0020.03912.91
5.3.180.0050.04012.94
5.3.170.0050.03512.87
5.3.160.0060.03512.87
5.3.150.0060.03412.93
5.3.140.0050.02712.86
5.3.130.0000.04412.94
5.3.120.0070.02512.92
5.3.110.0030.02112.92
5.3.100.0030.03012.59
5.3.90.0030.02212.57
5.3.80.0050.04012.60
5.3.70.0030.02512.54
5.3.60.0030.04012.65
5.3.50.0050.02012.60
5.3.40.0070.03812.53
5.3.30.0030.02112.61
5.3.20.0050.02812.40
5.3.10.0000.02912.48
5.3.00.0100.02312.38
5.2.170.0050.02511.21
5.2.160.0020.03411.20
5.2.150.0030.01811.20
5.2.140.0060.03011.20
5.2.130.0040.02611.20
5.2.120.0030.01711.21
5.2.110.0050.01811.20
5.2.100.0080.02811.20
5.2.90.0080.02811.20
5.2.80.0060.01811.20
5.2.70.0080.02511.20
5.2.60.0070.02511.20
5.2.50.0000.03711.20
5.2.40.0060.01811.20
5.2.30.0080.01711.20
5.2.20.0080.02311.20
5.2.10.0080.03011.20
5.2.00.0020.03511.20
5.1.60.0050.02511.20
5.1.50.0030.02711.20
5.1.40.0040.01811.20
5.1.30.0030.02811.20
5.1.20.0020.02111.20
5.1.10.0080.01011.20
5.1.00.0000.01511.20
5.0.50.0030.01811.20
5.0.40.0050.01911.20
5.0.30.0050.01911.20
5.0.20.0050.01311.20
5.0.10.0050.01011.20
5.0.00.0030.03211.20
4.4.90.0020.01911.20
4.4.80.0000.01311.20
4.4.70.0030.01711.20
4.4.60.0070.01511.20
4.4.50.0010.01311.20
4.4.40.0030.02411.20
4.4.30.0000.02111.20
4.4.20.0000.01211.20
4.4.10.0020.02111.20
4.4.00.0050.01311.20
4.3.110.0030.01011.20
4.3.100.0010.00911.20
4.3.90.0030.01011.20
4.3.80.0000.01811.20
4.3.70.0020.01911.20
4.3.60.0000.02011.20
4.3.50.0030.01911.20
4.3.40.0000.02311.20
4.3.30.0050.01611.20
4.3.20.0040.01711.20
4.3.10.0000.01311.20
4.3.00.0010.01811.20

preferences:
38.47 ms | 401 KiB | 5 Q