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'))); var_dump(extend(array('bar' => 'baz'))); var_dump(extend(array('bar' => 'baz')));

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.0090.00618.55
8.3.50.0120.01021.92
8.3.40.0120.00618.84
8.3.30.0140.00718.67
8.3.20.0040.00420.13
8.3.10.0000.00820.57
8.3.00.0000.00821.75
8.2.180.0120.00618.63
8.2.170.0110.00322.96
8.2.160.0100.00322.07
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0080.00020.94
8.2.120.0040.00426.35
8.2.110.0060.00322.11
8.2.100.0080.00417.91
8.2.90.0050.00319.17
8.2.80.0080.00017.97
8.2.70.0110.00317.35
8.2.60.0040.00418.04
8.2.50.0060.00318.09
8.2.40.0060.00322.27
8.2.30.0040.00419.65
8.2.20.0030.00517.80
8.2.10.0040.00418.05
8.2.00.0040.00418.24
8.1.280.0030.01225.92
8.1.270.0040.00422.19
8.1.260.0040.00428.09
8.1.250.0050.00328.09
8.1.240.0040.00423.77
8.1.230.0060.00620.88
8.1.220.0000.00917.76
8.1.210.0080.00018.77
8.1.200.0040.00417.10
8.1.190.0040.00417.35
8.1.180.0050.00318.10
8.1.170.0050.00318.55
8.1.160.0040.00420.79
8.1.150.0000.00920.68
8.1.140.0040.00419.47
8.1.130.0000.00717.73
8.1.120.0030.00317.42
8.1.110.0030.00517.36
8.1.100.0060.00317.56
8.1.90.0050.00217.54
8.1.80.0040.00417.46
8.1.70.0000.00717.43
8.1.60.0040.00417.50
8.1.50.0040.00417.59
8.1.40.0000.00817.59
8.1.30.0040.00417.67
8.1.20.0080.00017.42
8.1.10.0060.00317.64
8.1.00.0040.00417.44
8.0.300.0070.00018.77
8.0.290.0000.00816.88
8.0.280.0000.00718.33
8.0.270.0030.00317.29
8.0.260.0030.00517.29
8.0.250.0000.00717.06
8.0.240.0070.00017.10
8.0.230.0090.00016.97
8.0.220.0070.00016.96
8.0.210.0030.00316.82
8.0.200.0040.00417.05
8.0.190.0040.00417.07
8.0.180.0000.00717.02
8.0.170.0000.00716.98
8.0.160.0000.00816.83
8.0.150.0030.00316.95
8.0.140.0040.00416.81
8.0.130.0050.00013.36
8.0.120.0050.00316.82
8.0.110.0050.00216.91
8.0.100.0000.00716.83
8.0.90.0070.00016.87
8.0.80.0040.01117.04
8.0.70.0000.00716.85
8.0.60.0050.00316.86
8.0.50.0000.00817.03
8.0.30.0150.00517.16
8.0.20.0110.01117.40
8.0.10.0060.00317.11
8.0.00.0130.00816.85
7.4.330.0050.00016.89
7.4.320.0070.00016.63
7.4.300.0030.00316.59
7.4.290.0060.00316.51
7.4.280.0080.00016.61
7.4.270.0070.00016.57
7.4.260.0030.00516.49
7.4.250.0000.00716.47
7.4.240.0000.00716.67
7.4.230.0000.00716.63
7.4.220.0130.00616.50
7.4.210.0030.01116.70
7.4.200.0000.00716.32
7.4.160.0060.01016.62
7.4.150.0160.01017.40
7.4.140.0080.01217.86
7.4.130.0100.01016.58
7.4.120.0140.00416.54
7.4.110.0140.00316.68
7.4.100.0060.01216.41
7.4.90.0170.00016.65
7.4.80.0030.01219.39
7.4.70.0040.01316.40
7.4.60.0030.01516.57
7.4.50.0060.00916.46
7.4.40.0160.00316.46
7.4.30.0130.00716.70
7.4.00.0090.00715.16
7.3.330.0000.00613.44
7.3.320.0000.00613.51
7.3.310.0000.00716.28
7.3.300.0070.00016.30
7.3.290.0070.00916.46
7.3.280.0090.00916.44
7.3.270.0070.01017.40
7.3.260.0070.01116.45
7.3.250.0110.00816.49
7.3.240.0060.01116.43
7.3.230.0080.01016.63
7.3.210.0070.01016.42
7.3.200.0140.00416.71
7.3.190.0120.00916.70
7.3.180.0030.01316.36
7.3.170.0050.01316.45
7.3.160.0110.00416.51
7.3.120.0130.00314.94
7.3.110.0100.00614.58
7.3.100.0060.00914.84
7.3.90.0070.00714.78
7.3.80.0040.00714.82
7.3.70.0110.00414.96
7.3.60.0060.00614.56
7.3.50.0030.01014.81
7.3.40.0000.01414.82
7.3.30.0060.00314.97
7.3.20.0120.00316.67
7.3.10.0080.00316.67
7.3.00.0000.01516.56
7.2.330.0130.00516.73
7.2.320.0060.01216.64
7.2.310.0130.00316.70
7.2.300.0140.00716.68
7.2.290.0090.00616.80
7.2.250.0060.00915.04
7.2.240.0060.01315.09
7.2.230.0120.00615.15
7.2.220.0050.01014.91
7.2.210.0060.00314.96
7.2.200.0100.00715.18
7.2.190.0090.00615.02
7.2.180.0120.00315.05
7.2.170.0030.00714.88
7.2.60.0060.00916.91
7.2.00.0070.00719.52
7.1.330.0030.01015.71
7.1.320.0100.01015.79
7.1.310.0030.00615.86
7.1.300.0070.00715.66
7.1.290.0070.00715.56
7.1.280.0070.00715.77
7.1.270.0070.00315.83
7.1.260.0070.00715.88
7.1.200.0100.00615.91
7.1.100.0060.00617.87
7.1.70.0000.01117.20
7.1.60.0030.02019.19
7.1.50.0030.00817.02
7.1.00.0100.07022.31
7.0.200.0070.00714.71
7.0.60.0230.04019.86
7.0.50.0070.08317.88
7.0.40.0070.04720.05
7.0.30.0130.04720.27
7.0.20.0200.04720.15
7.0.10.0100.07720.28
7.0.00.0130.08320.15
5.6.280.0000.03720.91
5.6.210.0030.04720.57
5.6.200.0000.06318.18
5.6.190.0070.04320.61
5.6.180.0330.07320.46
5.6.170.0270.07720.56
5.6.160.0030.09320.54
5.6.150.0070.05018.14
5.6.140.0070.08018.11
5.6.130.0100.03718.14
5.6.120.0100.08021.12
5.6.110.0100.06321.03
5.6.100.0030.04721.11
5.6.90.0030.04021.14
5.6.80.0030.06020.48
5.5.350.0170.03720.29
5.5.340.0000.06318.09
5.5.330.0030.08720.31
5.5.320.0300.07020.25
5.5.310.0330.06320.34
5.5.300.0030.05017.98
5.5.290.0170.07318.01
5.5.280.0130.08020.88
5.5.270.0070.06320.89
5.5.260.0000.04720.98
5.5.250.0070.07320.67
5.5.240.0170.06320.07

preferences:
75.04 ms | 401 KiB | 5 Q