3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * test that filemtime() returns Unix timestamp (UTC) on current system */ $now = isset($_SERVER['REQUEST_TIME']) ? $_SERVER['REQUEST_TIME'] : time(); $timestampStartOfUnixEpoch = 0; // start of the Unix epoch. $timestampRequest = 3600 * (int)($now / 3600); $tempDir = function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : '/tmp'; $testFile = sprintf('%s/%s', $tempDir, 'test-filemtime'); 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('r', $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('r', $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.0150.00615.35
7.4.00.0070.01115.10
7.3.130.0040.00814.97
7.3.120.0070.01115.11
7.3.110.0060.01015.03
7.3.100.0030.01415.21
7.3.90.0040.00814.79
7.3.80.0070.01015.06
7.3.70.0120.00314.88
7.3.60.0060.00714.76
7.3.50.0060.00614.90
7.3.40.0090.00314.75
7.3.30.0030.00614.74
7.3.20.0090.00016.55
7.3.10.0060.00316.97
7.3.00.0040.01216.56
7.2.260.0070.01114.96
7.2.250.0070.01115.09
7.2.240.0060.00915.37
7.2.230.0080.00515.17
7.2.220.0040.00715.50
7.2.210.0040.01015.50
7.2.200.0060.00615.23
7.2.190.0030.01015.21
7.2.180.0000.01115.14
7.2.170.0070.00715.26
7.2.160.0040.01115.22
7.2.150.0080.00317.01
7.2.140.0030.00717.10
7.2.130.0000.00916.94
7.2.120.0100.00616.69
7.2.110.0070.00416.99
7.2.100.0040.00717.05
7.2.90.0120.00417.06
7.2.80.0060.00916.99
7.2.70.0000.01317.13
7.2.60.0030.00917.21
7.2.50.0000.01317.11
7.2.40.0040.00816.97
7.2.30.0090.00617.00
7.2.20.0000.00917.21
7.2.10.0060.00617.05
7.2.00.0070.01018.34
7.1.330.0160.00015.77
7.1.320.0030.00615.91
7.1.310.0100.00315.75
7.1.300.0100.00716.05
7.1.290.0040.01115.93
7.1.280.0100.00315.86
7.1.270.0030.01016.00
7.1.260.0080.00316.05
7.1.250.0030.00615.98
7.1.240.0080.00016.01
7.1.230.0040.00415.99
7.1.220.0030.00715.81
7.1.210.0120.00315.61
7.1.200.0090.00416.13
7.1.190.0040.01115.77
7.1.180.0110.00415.94
7.1.170.0040.01115.86
7.1.160.0040.00815.88
7.1.150.0060.00615.92
7.1.140.0030.00915.92
7.1.130.0070.00715.90
7.1.120.0070.00715.86
7.1.110.0060.00316.10
7.1.100.0020.01117.28
7.1.90.0040.01116.10
7.1.80.0030.01315.84
7.1.70.0030.01116.47
7.1.60.0030.01517.75
7.1.50.0090.01016.39
7.1.40.0060.00615.93
7.1.30.0000.00916.08
7.1.20.0030.00715.61
7.1.10.0060.00615.81
7.1.00.0100.03719.11
7.0.330.0030.00715.24
7.0.320.0000.01315.63
7.0.310.0090.00315.39
7.0.300.0070.00715.39
7.0.290.0000.00915.60
7.0.280.0060.00815.49
7.0.270.0070.00415.21
7.0.260.0000.01215.57
7.0.250.0090.00015.59
7.0.240.0040.01015.23
7.0.230.0110.00415.25
7.0.220.0130.00315.62
7.0.210.0100.00015.55
7.0.200.0030.00716.06
7.0.190.0040.00715.32
7.0.180.0060.00615.39
7.0.170.0070.00315.61
7.0.160.0030.00715.25
7.0.150.0080.00415.66
7.0.140.0020.04118.83
7.0.130.0110.00415.68
7.0.120.0110.00715.58
7.0.110.0040.01115.52
7.0.100.0010.02618.61
7.0.90.0050.02418.58
7.0.80.0060.02318.70
7.0.70.0030.02718.71
7.0.60.0010.02418.55
7.0.50.0150.01218.97
7.0.40.0060.03116.75
7.0.30.0030.04516.81
7.0.20.0050.04916.87
7.0.10.0070.04016.64
7.0.00.0050.03916.86
5.6.400.0120.00314.54
5.6.390.0000.01214.61
5.6.380.0070.01014.52
5.6.370.0060.00614.33
5.6.360.0030.00714.89
5.6.350.0060.00614.55
5.6.340.0100.00314.61
5.6.330.0000.01714.63
5.6.320.0030.00914.32
5.6.310.0060.00614.63
5.6.300.0040.00814.59
5.6.290.0030.00714.43
5.6.280.0100.03717.73
5.6.270.0060.01214.42
5.6.260.0030.00714.71
5.6.250.0030.02517.60
5.6.240.0020.03217.74
5.6.230.0000.03017.60
5.6.220.0020.02717.57
5.6.210.0000.02817.56
5.6.200.0000.03017.67
5.6.190.0050.02917.79
5.6.180.0060.02217.81
5.6.170.0070.04617.67
5.6.160.0030.03417.90
5.6.150.0070.04417.88
5.6.140.0030.04317.80
5.6.130.0090.03817.69
5.6.120.0140.02317.74
5.6.110.0030.02817.86
5.6.100.0050.04317.74
5.6.90.0040.03917.81
5.6.80.0070.04117.55
5.6.70.0080.04017.52
5.6.60.0050.03817.54
5.6.50.0070.03517.38
5.6.40.0120.03817.40
5.6.30.0070.02917.49
5.6.20.0030.04317.50
5.6.10.0030.04317.33
5.6.00.0100.03517.42
5.5.380.0060.02317.62
5.5.370.0050.02317.46
5.5.360.0000.02717.40
5.5.350.0030.02417.50
5.5.340.0030.02817.80
5.5.330.0050.04517.63
5.5.320.0060.04117.49
5.5.310.0100.04217.71
5.5.300.0050.04317.74
5.5.290.0060.04517.65
5.5.280.0070.04217.82
5.5.270.0010.04117.61
5.5.260.0020.04417.69
5.5.250.0030.02817.42
5.5.240.0060.04217.27
5.5.230.0070.02717.22
5.5.220.0030.04317.29
5.5.210.0060.04117.21
5.5.200.0060.04117.24
5.5.190.0030.04117.14
5.5.180.0010.03917.17
5.5.170.0030.01214.26
5.5.160.0080.02517.21
5.5.150.0050.04217.18
5.5.140.0090.04017.25
5.5.130.0090.03817.13
5.5.120.0100.02317.22
5.5.110.0050.04417.36
5.5.100.0050.04517.29
5.5.90.0080.03517.12
5.5.80.0080.03717.26
5.5.70.0090.03016.96
5.5.60.0000.04317.08
5.5.50.0020.04017.29
5.5.40.0020.04417.27
5.5.30.0060.04217.17
5.5.20.0030.02917.25
5.5.10.0070.02617.31
5.5.00.0080.02517.21
5.4.450.0020.02615.30
5.4.440.0030.04515.33
5.4.430.0080.02715.40
5.4.420.0060.03315.20
5.4.410.0030.03215.13
5.4.400.0020.03015.11
5.4.390.0030.04215.01
5.4.380.0050.04015.20
5.4.370.0060.02015.18
5.4.360.0060.04014.82
5.4.350.0030.04015.14
5.4.340.0050.04415.20
5.4.330.0030.00311.43
5.4.320.0000.04414.88
5.4.310.0060.04115.15
5.4.300.0030.04315.09
5.4.290.0060.02815.13
5.4.280.0060.02815.13
5.4.270.0020.04414.89
5.4.260.0050.02815.02
5.4.250.0040.03015.17
5.4.240.0020.04214.88
5.4.230.0050.03815.20
5.4.220.0040.04115.00
5.4.210.0050.04015.13
5.4.200.0030.03715.15
5.4.190.0030.03115.01
5.4.180.0050.03015.18
5.4.170.0050.02415.17
5.4.160.0070.03214.97
5.4.150.0010.03915.13
5.4.140.0050.03713.92
5.4.130.0020.03713.78
5.4.120.0030.02213.96
5.4.110.0110.02013.86
5.4.100.0020.03713.62
5.4.90.0000.04113.78
5.4.80.0050.02413.86
5.4.70.0030.04113.70
5.4.60.0030.04313.82
5.4.50.0050.04013.79
5.4.40.0030.03913.61
5.4.30.0060.02513.80
5.4.20.0080.03513.63
5.4.10.0020.04213.84
5.4.00.0020.03913.46
5.3.290.0030.07014.77
5.3.280.0070.06314.64
5.3.270.0000.04314.59
5.3.260.0070.03714.75
5.3.250.0000.07014.57
5.3.240.0230.05014.60
5.3.230.0070.04714.60
5.3.220.0030.03314.54
5.3.210.0070.03714.64
5.3.200.0000.05014.54
5.3.190.0030.07014.57
5.3.180.0030.06014.64
5.3.170.0100.05714.68
5.3.160.0030.07314.66
5.3.150.0000.08014.50
5.3.140.0030.07714.52
5.3.130.0000.06314.68
5.3.120.0030.05714.56
5.3.110.0070.04314.59
5.3.100.0070.07014.07
5.3.90.0030.07014.09
5.3.80.0030.07314.01
5.3.70.0000.07314.02
5.3.60.0030.07014.07
5.3.50.0000.07313.97
5.3.40.0070.03014.02
5.3.30.0030.07014.04
5.3.20.0030.06313.73
5.3.10.0030.05013.59
5.3.00.0000.07713.58
5.2.170.0030.04311.18
5.2.160.0000.03011.21
5.2.150.0070.05711.29
5.2.140.0030.06011.20
5.2.130.0000.06311.11
5.2.120.0000.06711.04
5.2.110.0030.05711.20
5.2.100.0070.03711.20
5.2.90.0070.05311.10
5.2.80.0030.05711.20
5.2.70.0070.03710.97
5.2.60.0000.05011.17
5.2.50.0030.03711.17
5.2.40.0100.03710.87
5.2.30.0030.03311.10
5.2.20.0030.02710.99
5.2.10.0000.06010.89
5.2.00.0070.05710.68
5.1.60.0000.04010.08
5.1.50.0030.04710.02
5.1.40.0030.0509.89
5.1.30.0070.03310.49
5.1.20.0070.02710.32
5.1.10.0000.0439.97
5.1.00.0030.05010.16
5.0.50.0030.0438.55
5.0.40.0070.0408.48
5.0.30.0070.0538.23
5.0.20.0000.0308.25
5.0.10.0000.0408.29
5.0.00.0030.0608.29
4.4.90.0000.0237.04
4.4.80.0000.0207.04
4.4.70.0000.0377.04
4.4.60.0000.0337.04
4.4.50.0030.0337.04
4.4.40.0000.0277.04
4.4.30.0000.0377.04
4.4.20.0030.0177.04
4.4.10.0000.0277.04
4.4.00.0000.0507.04
4.3.110.0000.0377.04
4.3.100.0030.0307.04
4.3.90.0000.0377.04
4.3.80.0000.0377.04
4.3.70.0070.0307.04
4.3.60.0000.0337.04
4.3.50.0000.0307.04
4.3.40.0000.0477.04
4.3.30.0030.0337.04
4.3.20.0000.0407.04
4.3.10.0000.0337.04
4.3.00.0000.0377.04

preferences:
37.3 ms | 400 KiB | 5 Q