3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * Complete the 'mergeArrays' function below. * * The function is expected to return an INTEGER_ARRAY. * The function accepts following parameters: * 1. INTEGER_ARRAY a * 2. INTEGER_ARRAY b */ function mergeArrays($a, $b) { $mergedArray = array_merge($a, $b); $sortedMergedArray = sorter($mergedArray); // for($i=0; $i<count($sortedMergedArray);$i++){ // echo $sortedMergedArray[$i] . "\n"; // } foreach($sortedMergedArray as $value) { echo $value . "\n"; } } function sorter($array) { for($i=0; $i<count($array);$i++){ for($j=$i+1; $j<count($array);$j++){ if($array[$i] > $array[$j]) { $tmp = $array[$i]; $array[$i] = $array[$j]; $array[$j] = $tmp; } } } return $array; } $result = mergeArrays([1,2], [3,4]); var_dump($result);

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.0100.00318.56
8.3.50.0140.00317.30
8.3.40.0120.00318.57
8.3.30.0070.00718.60
8.3.20.0080.00020.82
8.3.10.0070.00020.29
8.3.00.0020.00523.66
8.2.180.0120.00925.92
8.2.170.0150.00622.96
8.2.160.0120.00322.21
8.2.150.0000.00924.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0080.00026.16
8.2.110.0070.00421.10
8.2.100.0040.00817.84
8.2.90.0080.00018.28
8.2.80.0040.00418.34
8.2.70.0070.00317.63
8.2.60.0040.00417.48
8.2.50.0080.00017.75
8.2.40.0080.00017.93
8.2.30.0000.00819.26
8.2.20.0000.00718.18
8.2.10.0040.00418.99
8.2.00.0000.00719.55
8.1.280.0120.00625.92
8.1.270.0050.00323.99
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0090.00020.94
8.1.230.0040.00822.75
8.1.220.0030.00617.76
8.1.210.0040.00418.77
8.1.200.0000.00817.36
8.1.190.0040.00417.38
8.1.180.0040.00418.10
8.1.170.0030.00517.62
8.1.160.0040.00418.90
8.1.150.0000.00818.90
8.1.140.0050.00318.91
8.1.130.0000.00720.10
8.1.120.0050.00217.38
8.1.110.0000.00817.39
8.1.100.0050.00317.48
8.1.90.0040.00417.46
8.1.80.0040.00417.34
8.1.70.0000.00717.47
8.1.60.0030.00517.59
8.1.50.0080.00017.60
8.1.40.0040.00417.43
8.1.30.0040.00417.62
8.1.20.0060.00317.54
8.1.10.0000.00817.62
8.1.00.0000.00817.53
8.0.300.0040.00419.86
8.0.290.0000.00816.75
8.0.280.0000.00818.43
8.0.270.0080.00016.76
8.0.260.0030.00320.24
8.0.250.0030.00316.92
8.0.240.0000.00716.88
8.0.230.0080.00016.96
8.0.220.0030.00316.94
8.0.210.0080.00016.95
8.0.200.0040.00416.95
8.0.190.0000.00816.95
8.0.180.0030.00316.81
8.0.170.0030.00616.93
8.0.160.0000.00716.99
8.0.150.0060.00316.97
8.0.140.0000.00716.76
8.0.130.0000.00713.38
8.0.120.0040.00416.91
8.0.110.0070.00016.93
8.0.100.0030.00616.88
8.0.90.0000.00716.81
8.0.80.0060.00816.95
8.0.70.0000.00716.80
8.0.60.0040.00416.79
8.0.50.0070.00016.98
8.0.30.0120.00416.90
8.0.20.0060.01317.24
8.0.10.0000.00717.02
8.0.00.0080.01016.72
7.4.330.0030.00315.55
7.4.320.0030.00316.52
7.4.300.0030.00316.53
7.4.290.0000.00716.53
7.4.280.0060.00316.63
7.4.270.0000.00716.54
7.4.260.0070.00016.53
7.4.250.0000.00816.60
7.4.240.0050.00216.64
7.4.230.0070.00016.46
7.4.220.0000.00716.56
7.4.210.0090.00616.50
7.4.200.0070.00016.63
7.4.140.0060.01217.86
7.4.130.0100.00716.46
7.4.120.0040.01216.71
7.4.110.0110.01116.40
7.4.100.0030.01416.51
7.4.90.0070.01016.54
7.4.80.0060.01219.39
7.4.70.0130.00316.55
7.4.60.0100.00716.54
7.4.50.0080.00416.41
7.4.40.0070.01016.55
7.4.00.0090.00915.00
7.3.330.0050.00013.34
7.3.320.0000.00513.15
7.3.310.0030.00316.22
7.3.300.0070.00016.21
7.3.290.0070.00716.36
7.3.280.0070.00916.30
7.3.260.0130.00816.44
7.3.240.0100.01016.42
7.3.230.0090.00916.46
7.3.210.0090.00916.52
7.3.200.0060.01016.68
7.3.190.0140.00316.45
7.3.180.0080.01116.56
7.3.170.0090.00916.28
7.3.160.0040.01216.55
7.3.120.0090.00914.84
7.3.110.0100.00714.66
7.3.100.0070.00714.76
7.3.90.0140.00015.18
7.3.80.0070.00715.13
7.3.70.0040.01114.72
7.3.60.0070.00714.98
7.3.50.0100.00714.76
7.3.40.0110.00914.67
7.3.30.0140.00414.72
7.3.20.0060.00616.53
7.3.10.0150.00316.71
7.3.00.0130.00216.47
7.2.330.0080.00816.70
7.2.320.0120.00616.42
7.2.310.0040.01616.71
7.2.300.0150.00616.74
7.2.290.0130.01016.64
7.2.250.0000.01315.03
7.2.240.0030.01714.87
7.2.230.0030.01315.00
7.2.220.0060.01215.04
7.2.210.0070.01315.16
7.2.200.0000.01215.21
7.2.190.0030.01015.22
7.2.180.0050.01015.02
7.2.170.0050.01015.18
7.2.160.0080.00815.15
7.2.150.0140.00816.79
7.2.140.0080.00416.78
7.2.130.0070.00417.05
7.2.120.0130.00316.91
7.2.110.0080.00716.96
7.2.100.0100.00317.13
7.2.90.0080.00416.80
7.2.80.0070.01516.98
7.2.70.0140.00016.67
7.2.60.0120.00017.00
7.2.50.0070.00416.95
7.2.40.0070.01417.03
7.2.30.0000.01416.88
7.2.20.0030.01516.83
7.2.10.0060.00616.59
7.2.00.0090.00316.78
7.1.330.0140.00015.67
7.1.320.0100.00315.71
7.1.310.0040.01115.67
7.1.300.0070.00715.84
7.1.290.0000.01416.04
7.1.280.0070.00815.98
7.1.270.0060.00815.78
7.1.260.0040.01415.74
7.1.250.0060.00615.60

preferences:
66.35 ms | 400 KiB | 5 Q