3v4l.org

run code in 300+ PHP versions simultaneously
<?php function addArrayIfNotEmpty($entire_array, $key, $childArray){ count($childArray) ? $entire_array[$key] = $childArray : null; return $entire_array; } $entire_array = array(); $entire_array = addArrayIfNotEmpty($entire_array, 'key1', array()); print_r($entire_array); $entire_array = addArrayIfNotEmpty($entire_array, 'key2', array('hello')); print_r($entire_array);

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.10.0100.01022.36
8.3.140.0050.00316.54
8.3.130.0060.00616.55
8.3.120.0130.00320.53
8.3.110.0080.00816.65
8.3.100.0060.00318.55
8.3.90.0000.00826.77
8.3.80.0060.00316.63
8.3.70.0120.00916.75
8.3.60.0090.01316.49
8.3.50.0120.00923.59
8.3.40.0030.01218.84
8.3.30.0080.00618.54
8.3.20.0040.00424.18
8.3.10.0050.00324.66
8.3.00.0040.00426.16
8.2.260.0040.00416.73
8.2.250.0000.00816.73
8.2.240.0090.00916.61
8.2.230.0030.00620.94
8.2.220.0000.01024.06
8.2.210.0090.00626.77
8.2.200.0070.00318.66
8.2.190.0140.00716.58
8.2.180.0070.01125.92
8.2.170.0070.00722.96
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0000.00819.77
8.2.110.0030.00619.31
8.2.100.0060.00617.75
8.2.90.0040.00419.05
8.2.80.0090.00017.97
8.2.70.0030.00617.50
8.2.60.0060.00317.38
8.2.50.0040.00417.80
8.2.40.0040.00419.35
8.2.30.0000.00818.13
8.2.20.0040.00418.11
8.2.10.0040.00419.33
8.2.00.0000.00719.18
8.1.310.0110.00716.54
8.1.300.0090.00618.63
8.1.290.0060.00330.84
8.1.280.0100.01025.92
8.1.270.0040.00423.77
8.1.260.0030.00626.35
8.1.250.0070.00028.09
8.1.240.0040.00721.37
8.1.230.0090.00319.03
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0000.00817.64
8.1.190.0090.00017.35
8.1.180.0040.00418.10
8.1.170.0040.00417.62
8.1.160.0000.00718.93
8.1.150.0000.00718.80
8.1.140.0080.00018.89
8.1.130.0040.00420.09
8.1.120.0000.00717.41
8.1.110.0040.00417.44
8.1.100.0000.00717.44
8.1.90.0030.00317.38
8.1.80.0000.00817.38
8.1.70.0030.00317.37
8.1.60.0050.00317.63
8.1.50.0040.00417.50
8.1.40.0060.00617.50
8.1.30.0060.00317.67
8.1.20.0040.00417.61
8.1.10.0030.00517.60
8.1.00.0080.00017.43
8.0.300.0000.00718.78
8.0.290.0040.00416.75
8.0.280.0050.00318.40
8.0.270.0040.00417.94
8.0.260.0030.00318.31
8.0.250.0000.00616.82
8.0.240.0040.00416.92
8.0.230.0000.00716.86
8.0.220.0030.00316.81
8.0.210.0000.00716.87
8.0.200.0040.00416.88
8.0.190.0000.00716.79
8.0.180.0000.00816.82
8.0.170.0030.00616.96
8.0.160.0000.00716.86
8.0.150.0040.00416.89
8.0.140.0040.00416.90
8.0.130.0060.00013.32
8.0.120.0040.00416.77
8.0.110.0000.00716.83
8.0.100.0040.00416.84
8.0.90.0040.00416.95
8.0.80.0120.00316.75
8.0.70.0030.00316.81
8.0.60.0070.00016.78
8.0.50.0070.00016.96
8.0.30.0080.00816.87
8.0.20.0130.00917.03
8.0.10.0000.00817.01
8.0.00.0050.01316.50
7.4.330.0040.00015.55
7.4.320.0000.00716.56
7.4.300.0000.00616.59
7.4.290.0030.00316.59
7.4.280.0060.00316.61
7.4.270.0030.00316.50
7.4.260.0030.00313.30
7.4.250.0000.00716.33
7.4.240.0020.00516.62
7.4.230.0030.00716.68
7.4.220.0070.00016.56
7.4.210.0070.00716.59
7.4.200.0030.00616.34
7.4.130.0130.00516.50
7.4.120.0140.00416.51
7.4.110.0000.01616.47
7.4.100.0040.01116.60
7.4.90.0120.00316.59
7.4.80.0030.01319.39
7.4.70.0060.01516.48
7.4.60.0090.00616.71
7.4.50.0030.01316.55
7.4.40.0070.01016.66
7.4.30.0100.00616.45
7.4.20.0030.01316.59
7.4.10.0060.00916.40
7.4.00.0180.00016.61
7.3.330.0030.00316.25
7.3.320.0050.00013.24
7.3.310.0000.00716.43
7.3.300.0030.00316.24
7.3.290.0060.00816.36
7.3.280.0090.00616.34
7.3.260.0130.01216.55
7.3.240.0070.00916.55
7.3.230.0070.01016.60
7.3.210.0040.01216.65
7.3.200.0130.00316.29
7.3.190.0030.01316.50
7.3.180.0040.01116.64
7.3.170.0060.00916.32
7.3.160.0090.01216.46
7.3.150.0030.01316.61
7.3.140.0090.00616.36
7.3.130.0060.00916.42
7.3.120.0150.00616.70
7.3.110.0100.01016.30
7.3.100.0100.01016.37
7.3.90.0030.01716.36
7.3.80.0150.00616.56
7.3.70.0100.01016.27
7.3.60.0130.00316.52
7.3.50.0060.01516.38
7.3.40.0100.00716.42
7.3.30.0090.00816.35
7.3.20.0120.00616.54
7.3.10.0100.01316.31
7.3.00.0160.00016.42
7.2.330.0120.00816.72
7.2.320.0090.00916.70
7.2.310.0100.00716.66
7.2.300.0060.01216.37
7.2.290.0060.01016.49
7.2.280.0070.01016.46
7.2.270.0110.00516.72
7.2.260.0130.00316.36
7.2.250.0090.01216.68
7.2.240.0180.00416.45
7.2.230.0090.01216.41
7.2.220.0090.00916.66
7.2.210.0120.00916.59
7.2.200.0060.01016.53
7.2.190.0070.01016.57
7.2.180.0150.00716.55
7.2.170.0000.01716.67
7.2.160.0070.01016.43
7.2.150.0160.00316.65
7.2.140.0140.00316.56
7.2.130.0110.00816.60
7.2.120.0080.01216.48
7.2.110.0100.01016.54
7.2.100.0070.01316.56
7.2.90.0070.01316.46
7.2.80.0140.00316.69
7.2.70.0080.00816.55
7.2.60.0030.01416.63
7.2.50.0130.00316.64
7.2.40.0120.00616.57
7.2.30.0090.00916.72
7.2.20.0030.01316.59
7.2.10.0100.01016.61
7.2.00.0170.01316.47

preferences:
32.2 ms | 403 KiB | 5 Q