3v4l.org

run code in 300+ PHP versions simultaneously
<?php function randomString($len) { static $dict = 'abcdefghijklmnopqrstuvwxyz/.'; $dictLen = strlen($dict) - 1; $res = ''; for ($i = 0; $i < $len; $i++) { $res .= $dict[mt_rand(0, $dictLen)]; } return $res; } $i = 0; $m = 1000; // Array items to generate. $foo = memory_get_usage(); $cache = array(); for (; $i < $m; $i++) { $cache[randomString(25)] = randomString(40); if (($i + 1) % 100 == 0) echo ($i + 1) . ': ' . (memory_get_usage() - $foo - 80) . '<br>'; // $foo is 80 bytes } echo '<hr>'; var_dump(end($cache)); echo '<hr>'; $serialized = serialize($cache); $jsond = json_encode($cache); $count = 2000; $x = microtime(1); for ($i = $count; $i--;) $y3 = json_decode($jsond, true); echo microtime(1) - $x; echo ' <- json <br>'; var_dump(end($y3)); echo '<br>'; $x = microtime(1); for ($i = $count; $i--;) $y2 = unserialize($serialized); echo microtime(1) - $x; echo ' <- unser <br>'; var_dump(end($y2)); echo '<br>'; ?>

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.0031.23015.98
7.4.00.0071.67515.70
7.3.130.0101.71515.92
7.3.120.0131.68015.91
7.3.110.0131.59115.87
7.3.100.0001.64715.97
7.3.90.0031.61115.82
7.3.80.0071.66115.79
7.3.70.0031.54015.51
7.3.60.0071.42815.74
7.3.50.0071.59715.41
7.3.40.0101.47515.86
7.3.30.0001.25115.37
7.3.20.0031.18116.67
7.3.10.0071.39816.52
7.3.00.0031.66116.64
7.2.260.0171.66915.94
7.2.250.0101.26315.88
7.2.240.0031.27516.20
7.2.230.0001.23416.11
7.2.220.0101.26815.78
7.2.210.0031.34315.93
7.2.200.0031.42916.02
7.2.190.0091.39816.01
7.2.180.0071.80615.78
7.2.170.0001.71615.95
7.2.160.0031.61015.94
7.2.150.0071.53616.86
7.2.140.0231.40216.82
7.2.130.0031.68217.04
7.2.120.0031.65617.01
7.2.110.0101.38816.91
7.2.100.0071.57416.94
7.2.90.0031.66317.07
7.2.80.0031.39616.75
7.2.70.0071.43317.11
7.2.60.0101.45117.16
7.2.50.0031.40916.96
7.2.40.0031.84316.94
7.2.30.0071.66217.01
7.2.20.0071.48217.09
7.2.10.0031.29817.19
7.2.00.0021.29118.23
7.1.330.0031.29315.95
7.1.320.0031.64015.96
7.1.310.0001.27015.79
7.1.300.0031.56915.66
7.1.290.0071.60915.77
7.1.280.0031.51315.98
7.1.270.0031.60215.89
7.1.260.0031.63715.76
7.1.250.0071.67515.83
7.1.240.0001.27815.96
7.1.230.0001.57915.49
7.1.220.0001.64115.54
7.1.210.0031.64915.98
7.1.200.0071.60515.84
7.1.190.0071.51515.68
7.1.180.0071.37315.95
7.1.170.0071.51515.70
7.1.160.0071.37615.76
7.1.150.0031.34715.70
7.1.140.0031.73115.92
7.1.130.0161.42015.74
7.1.120.0031.32215.76
7.1.110.0101.61215.71
7.1.100.0071.66215.82
7.1.90.0071.67216.06
7.1.80.0001.47415.78
7.1.70.0031.33116.31
7.1.60.0071.35317.44
7.1.50.0151.16625.42
7.1.40.0001.59315.69
7.1.30.0031.64315.93
7.1.20.0071.63315.66
7.1.10.0031.51415.73
7.1.00.0001.22119.19
7.0.330.0001.33915.29
7.0.320.0031.50515.22
7.0.310.0071.73915.13
7.0.300.0071.55815.15
7.0.290.0031.62215.46
7.0.280.0101.72315.18
7.0.270.0031.53515.63
7.0.260.0051.61715.22
7.0.250.0001.63415.24
7.0.240.0031.22415.50
7.0.230.0031.66015.53
7.0.220.0031.64915.53
7.0.210.0071.66815.46
7.0.200.0051.33916.10
7.0.190.0001.49215.40
7.0.180.0071.19315.60
7.0.170.0001.51815.55
7.0.160.0031.57615.30
7.0.150.0031.74715.66
7.0.140.0021.25918.70
7.0.130.0031.71515.36
7.0.120.0071.54215.62
7.0.110.0071.69615.49
7.0.100.0031.69115.60
7.0.90.0121.06418.01
7.0.80.0271.35117.95
7.0.70.0331.33318.23
7.0.60.0071.37018.07
7.0.50.0081.19118.22
7.0.40.0031.22716.83
7.0.30.0081.17616.74
7.0.20.0031.37116.64
7.0.10.0051.37316.74
7.0.00.0051.38016.80
5.6.400.0002.49715.99
5.6.390.0102.48016.01
5.6.380.0002.49316.23
5.6.370.0032.49515.89
5.6.360.0102.48715.83
5.6.350.0032.49515.89
5.6.340.0002.49815.66
5.6.330.0032.49015.97
5.6.320.0072.48716.08
5.6.310.0032.49316.13
5.6.300.0002.49615.49
5.6.290.0032.48716.16
5.6.280.0002.26919.31
5.6.270.0082.48515.98
5.6.260.0132.48216.19
5.6.250.0002.49615.97
5.6.240.0032.49515.91
5.6.230.0052.13719.07
5.6.220.0072.26119.00
5.6.210.0122.28218.88
5.6.200.0072.27219.00
5.6.190.0072.27719.04
5.6.180.0072.28819.06
5.6.170.0072.19019.04
5.6.160.0022.24619.14
5.6.150.0132.24019.16
5.6.140.1042.22219.13
5.6.130.0102.29219.05
5.6.120.0032.19118.81
5.6.110.0052.16118.82
5.6.100.0032.08118.89
5.6.90.0032.12918.70
5.6.80.0072.17718.42
5.6.70.0192.02918.54
5.6.60.0082.10218.57
5.6.50.0052.14318.61
5.6.40.0122.05018.45
5.6.30.0082.15318.54
5.6.20.0102.15618.71
5.6.10.0102.14718.62
5.6.00.0102.16318.49
5.5.380.0032.49616.15
5.5.370.0082.25118.90
5.5.360.0032.29618.67
5.5.350.0102.17118.81
5.5.340.0072.20919.21
5.5.330.0082.28618.92
5.5.320.0002.18818.83
5.5.310.0052.22019.12
5.5.300.0022.20519.19
5.5.290.0052.27519.02
5.5.280.0032.12918.89
5.5.270.0112.11518.87
5.5.260.0032.11418.79
5.5.250.0102.15818.63
5.5.240.0052.15418.52
5.5.230.0122.17618.43
5.5.220.0032.13518.45
5.5.210.0052.04218.34
5.5.200.0022.17818.36
5.5.190.0032.16718.35
5.5.180.0072.18318.24
5.5.170.0032.49015.40
5.5.160.0072.10718.57
5.5.150.0502.08118.34
5.5.140.0072.03918.58
5.5.130.0072.01218.49
5.5.120.0052.15818.53
5.5.110.0052.07118.37
5.5.100.0052.14118.47
5.5.90.0052.10818.32
5.5.80.0032.07218.43
5.5.70.0002.11218.41
5.5.60.0032.15618.31
5.5.50.0102.16718.23
5.5.40.0032.12718.52
5.5.30.0082.18618.29
5.5.20.0072.20518.38
5.5.10.0082.15518.43
5.5.00.0052.09818.37
5.4.450.0052.25216.56
5.4.440.0072.10216.43
5.4.430.0022.03116.34
5.4.420.0032.10516.29
5.4.410.0032.03316.41
5.4.400.0072.11016.17
5.4.390.0052.11916.09
5.4.380.0072.07116.28
5.4.370.0082.08216.10
5.4.360.0032.06516.33
5.4.350.0051.95416.14
5.4.340.0072.16016.20
5.4.330.0072.48912.42
5.4.320.0032.08616.18
5.4.310.0022.08616.19
5.4.300.0002.03416.25
5.4.290.0022.04516.25
5.4.280.0032.08916.14
5.4.270.0072.07816.02
5.4.260.0031.98916.02
5.4.250.0081.99716.13
5.4.240.0052.06216.14
5.4.230.0032.11116.25
5.4.220.0032.06316.32
5.4.210.0551.99716.10
5.4.200.0032.04916.06
5.4.190.0032.11416.13
5.4.180.0072.07016.20
5.4.170.0052.08916.03
5.4.160.0082.11716.36
5.4.150.0052.05615.98
5.4.140.0082.02314.75
5.4.130.0072.16714.98
5.4.120.0102.12814.74
5.4.110.0072.10114.77
5.4.100.0052.11514.75
5.4.90.0062.10014.78
5.4.80.0022.12714.85
5.4.70.0032.03214.98
5.4.60.0072.09114.84
5.4.50.0032.05014.88
5.4.40.0022.01714.94
5.4.30.0072.12714.69
5.4.20.0052.10214.92
5.4.10.0082.09714.84
5.4.00.0032.11314.40
5.3.290.0132.11813.68
5.3.280.0112.13513.64
5.3.270.0102.15513.64
5.3.260.0102.14813.45
5.3.250.0132.14213.63
5.3.240.0032.04213.64
5.3.230.0072.15213.55
5.3.220.0102.16513.52
5.3.210.0072.17113.56
5.3.200.0022.07713.62
5.3.190.0032.17113.63
5.3.180.0052.07413.66
5.3.170.0032.19113.70
5.3.160.0022.13713.58
5.3.150.0082.14713.59
5.3.140.0072.16613.72
5.3.130.0082.17613.58
5.3.120.0082.18813.63
5.3.110.0102.18213.63
5.3.100.0122.15713.43
5.3.90.0032.12913.35
5.3.80.0022.04213.23
5.3.70.0032.12313.17
5.3.60.0052.15313.30
5.3.50.0032.12713.19
5.3.40.0072.15113.28
5.3.30.0032.01513.33
5.3.20.0051.99513.20
5.3.10.0052.13413.04
5.3.00.0082.04013.01
5.2.170.0031.72312.30
5.2.160.0071.89012.12
5.2.150.0031.93711.94
5.2.140.0101.78712.09
5.2.130.0071.92012.21
5.2.120.0031.96012.41
5.2.110.0131.91312.08
5.2.100.0031.86712.05
5.2.90.0031.87012.11
5.2.80.0001.87012.27
5.2.70.1171.88012.06
5.2.60.0001.88012.16
5.2.50.0032.09012.10
5.2.40.0031.97312.33
5.2.30.0102.03012.07
5.2.20.0001.86011.94
5.2.10.0071.72711.57
5.2.00.0070.06010.82
5.1.60.0070.02010.04
5.1.50.0070.04310.11
5.1.40.0030.0539.83
5.1.30.0000.06310.38
5.1.20.0030.05710.36
5.1.10.0030.05710.11
5.1.00.0130.04710.16
5.0.50.0030.0338.45
5.0.40.0030.0438.53
5.0.30.0030.0508.41
5.0.20.0000.0408.41
5.0.10.0070.0438.41
5.0.00.0030.0338.41
4.4.90.0000.0378.41
4.4.80.0000.0378.41
4.4.70.0070.0338.41
4.4.60.0000.0308.41
4.4.50.0070.0278.41
4.4.40.0030.0508.41
4.4.30.0070.0338.41
4.4.20.0030.0378.41
4.4.10.0030.0308.41
4.4.00.0100.0338.41
4.3.110.0000.0378.41
4.3.100.0000.0378.41
4.3.90.0000.0308.41
4.3.80.0000.0508.41
4.3.70.0030.0338.41
4.3.60.0000.0308.41
4.3.50.0030.0278.41
4.3.40.0030.0438.41
4.3.30.0030.0338.41
4.3.20.0030.0278.41
4.3.10.0000.0278.41
4.3.00.0070.0238.41

preferences:
40.18 ms | 401 KiB | 5 Q