3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(phpversion()); $some_objects = [ new SomeClass(1), new SomeClass(2), new SomeClass(3), new SomeClass(4), ]; $func = function(SomeClass $x) { $x->some_function(); return $x; }; array_walk($some_objects, $func); var_dump($some_objects); $mangled_result = array_map($func, $some_objects); var_dump($mangled_result); class SomeClass { private $number; public function __construct($number) { $this->number = $number; } public function some_function() { try { throw new Exception(); } catch (Exception $e) { MANGLE_SOMEHOW($e->getTrace()); } } } function MANGLE_SOMEHOW($trace) { foreach ($trace as $i => $frame) { if (isset($frame['args'])) { foreach ($frame['args'] as $arg_index => $arg_value) { // And here I was thinking this was a 'copy'??? $frame['args'][$arg_index] = $arg_value; } } } }

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.2.80.0100.00316.57
7.2.60.0070.00716.54
7.2.00.0030.00919.37
7.1.200.0030.01015.86
7.1.100.0000.01018.19
7.1.70.0000.00817.14
7.1.60.0100.00319.40
7.1.50.0040.01417.14
7.1.00.0000.08022.36
7.0.200.0000.00716.81
7.0.140.0000.07321.95
7.0.100.0030.06019.93
7.0.90.0000.04319.90
7.0.80.0170.03719.82
7.0.70.0100.05719.90
7.0.60.0270.05320.03
7.0.50.0200.05020.32
7.0.40.0000.09020.01
7.0.30.0030.09020.05
7.0.20.0030.09020.14
7.0.10.0030.08020.07
7.0.00.0030.08320.03
5.6.280.0030.07021.06
5.6.250.0130.08020.60
5.6.240.0000.04720.48
5.6.230.0030.08320.53
5.6.220.0000.05720.46
5.6.210.0100.07320.54
5.6.200.0100.07721.06
5.6.190.0030.08021.02
5.6.180.0130.07021.08
5.6.170.0070.08320.99
5.6.160.0100.05720.96
5.6.150.0100.08021.14
5.6.140.0100.04320.90
5.6.130.0030.07020.98
5.6.120.0030.09020.91
5.6.110.0000.08320.91
5.6.100.0100.08020.92
5.6.90.0130.06321.13
5.6.80.0170.06020.31
5.6.70.0070.08020.37
5.6.60.0030.06320.30
5.6.50.0000.08720.40
5.6.40.0100.05020.44
5.6.30.0030.04320.48
5.6.20.0030.08720.36
5.6.10.0000.07020.36
5.6.00.0030.05320.32
5.5.380.0070.03720.33
5.5.370.0030.08020.37
5.5.360.0030.07020.31
5.5.350.0070.04320.41
5.5.340.0100.07720.81
5.5.330.0030.08320.61
5.5.320.0100.07020.72
5.5.310.0200.06720.77
5.5.300.0070.08320.85
5.5.290.0070.07720.61
5.5.280.0100.07320.80
5.5.270.0100.03720.72
5.5.260.0030.07320.85
5.5.250.0070.08020.41
5.5.240.0100.07720.09
5.5.230.0070.07020.15
5.5.220.0100.06020.27
5.5.210.0100.07720.08
5.5.200.0130.03020.07
5.5.190.0100.07720.21
5.5.180.0130.07320.13
5.5.160.0030.04020.16
5.5.150.0070.03720.12
5.5.140.0000.03720.15
5.5.130.0130.05720.08
5.5.120.0000.04320.14
5.5.110.0070.03720.10
5.5.100.0030.04019.98
5.5.90.0130.02720.13
5.5.80.0030.04320.13
5.5.70.0030.04019.92
5.5.60.0030.03720.00
5.5.50.0030.04020.03
5.5.40.0000.04019.93
5.5.30.0030.04020.00
5.5.20.0070.04020.00
5.5.10.0000.04020.09
5.5.00.0030.04320.05
5.4.450.0070.07719.55
5.4.440.0000.09019.36
5.4.430.0100.07019.46
5.4.420.0100.04319.32
5.4.410.0070.07319.36
5.4.400.0030.06719.19
5.4.390.0100.07319.21
5.4.380.0100.07319.04
5.4.370.0130.04019.09
5.4.360.0070.07019.04
5.4.350.0070.09319.14
5.4.340.0030.07719.09
5.4.320.0070.03019.16
5.4.310.0000.05019.16
5.4.300.0030.07719.14
5.4.290.0030.04018.90
5.4.280.0000.04319.04
5.4.270.0070.03319.04
5.4.260.0000.04018.85
5.4.250.0000.04018.85
5.4.240.0030.04719.04
5.4.230.0000.04319.23
5.4.220.0030.04019.11
5.4.210.0000.04319.04
5.4.200.0030.04019.09
5.4.190.0100.03319.13
5.4.180.0030.03719.08
5.4.170.0000.04019.23
5.4.160.0030.03719.14
5.4.150.0000.04319.12
5.4.140.0000.04016.43
5.4.130.0070.04316.50
5.4.120.0030.03316.46
5.4.110.0000.04016.38
5.4.100.0100.02716.41
5.4.90.0070.07316.39
5.4.80.0000.06316.44
5.4.70.0070.04316.38
5.4.60.0070.06316.45
5.4.50.0030.06016.41
5.4.40.0030.07716.53
5.4.30.0030.06316.37
5.4.20.0000.06716.33
5.4.10.0030.07016.29
5.4.00.0070.07315.84
5.3.290.0100.02314.66
5.3.280.0000.04014.45
5.3.270.0000.04014.58
5.3.260.0030.03714.57
5.3.250.0000.04014.46
5.3.240.0030.03714.59
5.3.230.0100.03014.56
5.3.220.0000.08014.56
5.3.210.0030.07714.51
5.3.200.0100.06314.55
5.3.190.0000.08014.57
5.3.180.0100.03014.48
5.3.170.0170.04714.53
5.3.160.0070.06714.55
5.3.150.0070.04714.52
5.3.140.0130.06714.55
5.3.130.0070.07314.54
5.3.120.0170.06314.41
5.3.110.0070.05014.54
5.3.100.0000.07014.03
5.3.90.0030.05714.01
5.3.80.0170.06013.87
5.3.70.0100.07713.99
5.3.60.0070.05313.96
5.3.50.0030.03713.73
5.3.40.0100.06313.91
5.3.30.0130.05313.91
5.3.20.0030.04013.55
5.3.10.0030.06313.61
5.3.00.0030.07013.50
5.2.170.0030.06311.14
5.2.160.0030.05711.06
5.2.150.0030.03711.10
5.2.140.0000.06710.98
5.2.130.0070.05011.14
5.2.120.0030.06010.95
5.2.110.0030.05711.14
5.2.100.0030.06310.94
5.2.90.0000.04011.12
5.2.80.0000.06711.13
5.2.70.0070.03311.05
5.2.60.0030.06010.87
5.2.50.0030.04311.05
5.2.40.0130.04310.95
5.2.30.0000.04710.83
5.2.20.0030.03010.98
5.2.10.0070.05710.91
5.2.00.0100.03710.77
5.1.60.0070.0209.98
5.1.50.0070.0379.98
5.1.40.0030.0579.97
5.1.30.0130.04010.27
5.1.20.0000.03710.39
5.1.10.0030.05310.07
5.1.00.0070.03310.15
5.0.50.0070.0378.56
5.0.40.0000.0208.45
5.0.30.0070.0578.25
5.0.20.0000.0308.19
5.0.10.0070.0408.00
5.0.00.0000.0378.00
4.4.90.0030.0238.00
4.4.80.0070.0308.00
4.4.70.0000.0178.00
4.4.60.0030.0378.00
4.4.50.0000.0378.00
4.4.40.0000.0238.00
4.4.30.0000.0338.00
4.4.20.0000.0378.00
4.4.10.0070.0308.00
4.4.00.0000.0308.00
4.3.110.0030.0178.00
4.3.100.0070.0108.00
4.3.90.0030.0208.00
4.3.80.0070.0508.00
4.3.70.0000.0308.00
4.3.60.0030.0338.00
4.3.50.0000.0378.00
4.3.40.0030.0508.00
4.3.30.0000.0238.00
4.3.20.0000.0178.00
4.3.10.0030.0338.00
4.3.00.0000.0438.00

preferences:
37.45 ms | 401 KiB | 5 Q