3v4l.org

run code in 300+ PHP versions simultaneously
<?php function extend($base, $replacements) { $base = !is_array($base) ? array() : $base; $replacements = !is_array($replacements) ? array() : $replacements; $ret = array(); foreach ($base as $key => $val) { if (is_int($key)) { // value without key $ret[$val] = null; } else { $ret[$key] = $val; } } return array_replace_recursive($ret, $replacements); } var_dump(extend(array('foo' => 'bar'), array('bar' => 'baz'))); var_dump(extend(array('foo' => 'bar'), array('foo' => 'foo'))); var_dump(extend(array('bar' => 'baz'), array('bar' => 'bar')));

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.3.60.0070.00718.31
8.3.50.0100.01022.11
8.3.40.0090.00918.68
8.3.30.0100.00718.68
8.3.20.0040.00420.20
8.3.10.0000.00820.53
8.3.00.0000.00721.63
8.2.180.0070.01118.16
8.2.170.0140.00322.96
8.2.160.0100.00322.09
8.2.150.0090.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00019.79
8.2.110.0070.00421.11
8.2.100.0040.00817.78
8.2.90.0080.00019.17
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0060.00318.16
8.2.50.0000.00818.09
8.2.40.0040.00422.28
8.2.30.0040.00419.39
8.2.20.0040.00417.81
8.2.10.0000.00718.21
8.2.00.0000.00718.13
8.1.280.0120.00325.92
8.1.270.0090.00021.96
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00322.67
8.1.230.0060.00617.42
8.1.220.0050.00317.79
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0080.00417.22
8.1.180.0040.00418.10
8.1.170.0040.00418.66
8.1.160.0030.00520.77
8.1.150.0030.00620.57
8.1.140.0000.00919.59
8.1.130.0000.00717.75
8.1.120.0040.00417.44
8.1.110.0040.00417.47
8.1.100.0030.00517.30
8.1.90.0040.00417.45
8.1.80.0000.00717.43
8.1.70.0000.00717.36
8.1.60.0000.00917.48
8.1.50.0080.00017.50
8.1.40.0030.00617.42
8.1.30.0030.00517.66
8.1.20.0050.00317.42
8.1.10.0040.00417.44
8.1.00.0000.00717.43
8.0.300.0060.00318.77
8.0.290.0000.00716.75
8.0.280.0030.00318.38
8.0.270.0070.00017.15
8.0.260.0000.00617.18
8.0.250.0070.00016.84
8.0.240.0000.00716.86
8.0.230.0000.00716.96
8.0.220.0030.00316.93
8.0.210.0050.00216.88
8.0.200.0000.00816.98
8.0.190.0000.00716.83
8.0.180.0000.00716.96
8.0.170.0000.00716.83
8.0.160.0000.00716.80
8.0.150.0050.00316.85
8.0.140.0040.00416.74
8.0.130.0000.00613.23
8.0.120.0090.00016.94
8.0.110.0030.00616.84
8.0.100.0070.00016.79
8.0.90.0040.00416.78
8.0.80.0130.00316.82
8.0.70.0040.00416.94
8.0.60.0040.00416.73
8.0.50.0040.00416.86
8.0.30.0030.01417.30
8.0.20.0140.00717.40
8.0.10.0040.00417.06
8.0.00.0080.01116.77
7.4.330.0000.00516.89
7.4.320.0070.00016.62
7.4.300.0000.00616.56
7.4.290.0030.00716.60
7.4.280.0040.00416.43
7.4.270.0030.00316.50
7.4.260.0000.00816.43
7.4.250.0040.00416.46
7.4.240.0070.00016.50
7.4.230.0030.00316.65
7.4.220.0120.01516.48
7.4.210.0090.00616.46
7.4.200.0000.00716.65
7.4.160.0120.00416.66
7.4.150.0140.00317.40
7.4.140.0150.01417.86
7.4.130.0120.00816.49
7.4.120.0110.00716.62
7.4.110.0030.01516.48
7.4.100.0060.01216.50
7.4.90.0150.00316.67
7.4.80.0140.00719.39
7.4.70.0130.00316.57
7.4.60.0130.00316.48
7.4.50.0100.00616.43
7.4.40.0190.00316.46
7.4.30.0100.01016.39
7.4.00.0030.01215.07
7.3.330.0030.00313.23
7.3.320.0030.00313.29
7.3.310.0030.00316.43
7.3.300.0050.00216.28
7.3.290.0060.01016.36
7.3.280.0060.01116.40
7.3.270.0000.01617.40
7.3.260.0140.00316.60
7.3.250.0090.00816.38
7.3.240.0160.00316.45
7.3.230.0090.00816.39
7.3.210.0070.01016.42
7.3.200.0080.00816.36
7.3.190.0090.00916.34
7.3.180.0110.00716.52
7.3.170.0130.01016.59
7.3.160.0130.00416.53
7.2.330.0150.00916.66
7.2.320.0100.01016.52
7.2.310.0140.00316.66
7.2.300.0100.00816.47
7.2.290.0100.00716.40
7.2.60.0060.00616.92
7.2.50.0170.00716.90
7.2.00.0000.01119.18
7.1.200.0090.00015.47
7.1.100.0000.01218.05
7.1.70.0030.01317.21
7.1.60.0110.01419.19
7.1.50.0000.01317.10
7.1.00.0070.07322.28
7.0.200.0030.01014.70
7.0.60.0030.08721.86
7.0.50.0070.07717.96
7.0.40.0030.06320.40
7.0.30.0230.03720.06
7.0.20.0370.06020.07
7.0.10.0030.09020.15
7.0.00.0070.07720.06
5.6.280.0100.02721.07
5.6.210.0070.07020.50
5.6.200.0100.07718.29
5.6.190.0000.07720.33
5.6.180.0430.06320.48
5.6.170.0270.04020.62
5.6.160.0130.07320.54
5.6.150.0030.07718.19
5.6.140.0030.08318.17
5.6.130.0070.04018.11
5.6.120.0100.06021.14
5.6.110.0200.07020.99
5.6.100.0000.04321.11
5.6.90.0030.06721.01
5.6.80.0070.08020.37
5.5.350.0200.03720.36
5.5.340.0030.08318.09
5.5.330.0100.06720.40
5.5.320.0370.07020.26
5.5.310.0430.05720.42
5.5.300.0070.04718.04
5.5.290.0170.05317.97
5.5.280.0100.08020.87
5.5.270.0130.08020.64
5.5.260.0030.04020.73
5.5.250.0100.08320.50
5.5.240.0030.07320.19

preferences:
41.82 ms | 404 KiB | 6 Q