3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeHelperClass { public $_arr = []; public function addValue($value, $key = null): void { if ($key !== null) { $this->_arr[$key] = $value; } else { for ($i = 0, $count = count($this->_arr); $i <= $count; ++$i) { if (!key_exists($i, $this->_arr)) { $this->_arr[$i] = $value; break; } } } } } $test = new SomeHelperClass; var_export($test->_arr); echo "\n"; $test->addValue(1); var_export($test->_arr); echo "\n"; $test->addValue(2); var_export($test->_arr); echo "\n"; $test->addValue(3, 4); var_export($test->_arr); echo "\n"; $test->addValue(4, 3); var_export($test->_arr); echo "\n"; $test->addValue(5); var_export($test->_arr);

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)
8.4.120.0120.00920.70
8.4.110.0160.00318.84
8.4.100.0050.00417.68
8.4.90.0100.01020.52
8.4.80.0070.00418.81
8.4.70.0120.00920.64
8.4.60.0110.00920.69
8.4.50.0140.00617.79
8.4.40.0060.00317.71
8.4.30.0070.01020.53
8.4.20.0040.00424.14
8.4.10.0060.00323.82
8.3.250.0100.00918.86
8.3.240.0140.00616.26
8.3.230.0090.01016.23
8.3.220.0110.00920.94
8.3.210.0120.00718.46
8.3.200.0050.00416.55
8.3.190.0130.00517.07
8.3.180.0120.00818.36
8.3.170.0110.00718.90
8.3.160.0080.00018.63
8.3.150.0150.00317.12
8.3.140.0090.00917.45
8.3.130.0080.00018.52
8.3.120.0070.01120.71
8.3.110.0040.01220.94
8.3.100.0060.00324.06
8.3.90.0080.00026.77
8.3.80.0030.00617.97
8.3.70.0170.00316.80
8.3.60.0140.00416.50
8.3.50.0120.00616.80
8.3.40.0120.00920.19
8.3.30.0120.00318.80
8.3.20.0080.00024.18
8.3.10.0000.00724.66
8.3.00.0040.00426.16
8.2.290.0100.01017.40
8.2.280.0120.00820.02
8.2.270.0060.01216.56
8.2.260.0030.00718.49
8.2.250.0110.00418.47
8.2.240.0030.00717.18
8.2.230.0100.00022.58
8.2.220.0080.00037.54
8.2.210.0100.01026.77
8.2.200.0000.01216.75
8.2.190.0130.00916.75
8.2.180.0110.01116.63
8.2.170.0120.00418.82
8.2.160.0070.00722.96
8.2.150.0000.00725.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00817.50
8.2.110.0030.00622.20
8.2.100.0080.00417.72
8.2.90.0000.00817.88
8.2.80.0000.00918.91
8.2.70.0060.00317.63
8.2.60.0030.00617.38
8.2.50.0050.00317.55
8.2.40.0110.00817.75
8.2.30.0180.00017.62
8.2.20.0170.00317.62
8.2.10.0150.00417.62
8.2.00.0120.00617.62
8.1.330.0100.00918.15
8.1.320.0150.00417.93
8.1.310.0000.00718.48
8.1.300.0090.00619.51
8.1.290.0000.01030.84
8.1.280.0070.01025.92
8.1.270.0050.00324.66
8.1.260.0000.00726.35
8.1.250.0060.00328.09
8.1.240.0110.00022.04
8.1.230.0070.00422.69
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0000.00817.48
8.1.190.0050.00317.36
8.1.180.0090.00019.01
8.1.170.0140.00417.62
8.1.160.0080.01217.62
8.1.150.0130.00617.62
8.1.140.0140.00417.62
8.1.130.0180.00017.62
8.1.120.0150.00417.62
8.1.110.0180.00017.62
8.1.100.0080.00817.62
8.1.90.0150.00417.62
8.1.80.0130.00817.62
8.1.70.0120.00617.62
8.1.60.0080.01117.62
8.1.50.0180.00017.62
8.1.40.0190.00417.62
8.1.30.0200.00017.62
8.1.20.0130.00819.05
8.1.10.0170.00317.62
8.1.00.0160.00417.62
8.0.300.0000.00718.77
8.0.290.0040.00416.63
8.0.280.0180.00017.62
8.0.270.0180.00017.62
8.0.260.0170.00317.62
8.0.250.0150.00517.62
8.0.240.0120.00617.62
8.0.230.0090.00917.62
8.0.220.0170.00317.62
8.0.210.0120.00617.62
8.0.200.0070.01317.62
8.0.190.0150.00417.62
8.0.180.0180.00017.62
8.0.170.0130.00517.62
8.0.160.0150.00418.18
8.0.150.0110.00818.43
8.0.140.0140.00417.62
8.0.130.0190.00017.62
8.0.120.0090.00917.62
8.0.110.0110.00817.62
8.0.100.0180.00017.62
8.0.90.0070.01117.62
8.0.80.0120.00817.62
8.0.70.0170.00217.62
8.0.60.0200.00017.62
8.0.50.0120.00517.62
8.0.30.0130.00417.62
8.0.20.0160.00317.62
8.0.10.0120.00617.62

preferences:
27.8 ms | 403 KiB | 5 Q