3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = ["", "", "3", "", "5", "", ""]; $array2 = ["URD", "ISL"]; foreach($array1 as $id => $a1){ //for each item in array 1 if($a1){ //if the array 1 item has a value $array1[$id] = array_shift($array2); //replace it with an item from array 2 } if(empty($array2)){ //if there are no more values left to share in array 2, stop break; } } var_dump($array1);

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.70.0040.01116.75
8.3.60.0120.00318.18
8.3.50.0070.01118.29
8.3.40.0120.00318.45
8.3.30.0080.00818.57
8.3.20.0000.00820.85
8.3.10.0000.00820.54
8.3.00.0070.00022.51
8.2.190.0160.00616.58
8.2.180.0110.00718.51
8.2.170.0110.00422.96
8.2.160.0100.01020.22
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0080.00021.00
8.2.110.0000.01119.17
8.2.100.0080.00317.84
8.2.90.0030.00617.50
8.2.80.0070.00718.68
8.2.70.0040.00417.75
8.2.60.0000.00817.75
8.2.50.0040.00417.63
8.2.40.0050.00219.56
8.2.30.0040.00419.30
8.2.20.0070.00018.00
8.2.10.0040.00419.41
8.2.00.0040.00418.00
8.1.280.0180.00325.92
8.1.270.0040.00418.76
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0060.00323.76
8.1.230.0090.00320.74
8.1.220.0000.00818.56
8.1.210.0030.00518.77
8.1.200.0040.00417.35
8.1.190.0110.00417.13
8.1.180.0040.00418.10
8.1.170.0000.00918.56
8.1.160.0000.00718.80
8.1.150.0070.00018.93
8.1.140.0070.00020.20
8.1.130.0000.00920.27
8.1.120.0040.00317.43
8.1.110.0060.00317.46
8.1.100.0040.00417.48
8.1.90.0070.00017.48
8.1.80.0000.00717.34
8.1.70.0040.00417.32
8.1.60.0000.00917.59
8.1.50.0000.00817.46
8.1.40.0050.00317.39
8.1.30.0000.00817.61
8.1.20.0060.00617.55
8.1.10.0040.00417.61
8.1.00.0000.00817.53
8.0.300.0080.00018.77
8.0.290.0040.00416.63
8.0.280.0000.00718.49
8.0.270.0070.00016.86
8.0.260.0050.00318.46
8.0.250.0000.00716.90
8.0.240.0000.00816.97
8.0.230.0030.00517.02
8.0.220.0040.00416.94
8.0.210.0000.01016.89
8.0.200.0000.00616.97
8.0.190.0080.00016.95
8.0.180.0000.00716.95
8.0.170.0040.00416.87
8.0.160.0080.00016.93
8.0.150.0040.00416.79
8.0.140.0070.00016.80
8.0.130.0030.00313.35
8.0.120.0000.00816.83
8.0.110.0000.00716.88
8.0.100.0050.00216.96
8.0.90.0080.00016.96
8.0.80.0120.00916.85
8.0.70.0040.00416.71
8.0.60.0040.00416.79
8.0.50.0040.00416.84
8.0.30.0130.00716.98
8.0.20.0150.00916.99
8.0.10.0070.00016.95
8.0.00.0050.01316.70
7.4.330.0030.00315.55
7.4.320.0000.00616.53
7.4.300.0040.00416.50
7.4.290.0000.00716.61
7.4.280.0040.00416.64
7.4.270.0000.01016.61
7.4.260.0000.00716.56
7.4.250.0070.00016.41
7.4.240.0030.00316.61
7.4.230.0030.00316.63
7.4.220.0040.00416.43
7.4.210.0070.00916.53
7.4.200.0030.00316.55
7.4.160.0090.00516.57
7.4.140.0140.00417.86
7.4.130.0070.01416.52
7.4.120.0120.00616.52
7.4.110.0110.00716.54
7.4.100.0110.01116.58
7.4.90.0070.01016.51
7.4.80.0060.01319.39
7.4.70.0100.01416.39
7.4.60.0080.01116.43
7.4.50.0130.00316.32
7.4.40.0140.00316.47
7.4.00.0000.00915.11
7.3.330.0000.00513.16
7.3.320.0000.00513.21
7.3.310.0030.00316.37
7.3.300.0070.00016.34
7.3.290.0000.00716.32
7.3.280.0070.00916.37
7.3.260.0100.01016.41
7.3.240.0100.01116.51
7.3.230.0060.01116.36
7.3.210.0080.00816.48
7.3.200.0090.00616.42
7.3.190.0080.01716.23
7.3.180.0030.01516.41
7.3.170.0030.01416.30
7.3.160.0120.00416.41
7.3.20.0500.00614.84
7.3.10.0570.01114.70
7.3.00.0690.00714.85
7.2.330.0090.00916.45
7.2.320.0120.00416.45
7.2.310.0110.00616.56
7.2.300.0100.00716.68
7.2.290.0060.01216.71
7.2.150.0550.00015.06
7.2.140.0570.00015.11
7.2.130.0580.00315.00
7.2.120.0600.01214.69
7.2.110.0580.01314.58
7.2.100.0500.00314.95
7.2.90.0660.01014.55
7.2.80.0620.00714.99
7.2.70.0470.02015.11
7.2.60.0830.01014.93
7.2.50.0580.00314.71
7.2.40.0530.00714.92
7.2.30.0510.01015.12
7.2.20.0530.00315.16
7.2.10.0520.00314.85
7.2.00.0560.00715.11
7.1.250.0550.01313.89

preferences:
56.64 ms | 401 KiB | 5 Q