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);
based on eRMRL

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.0.30.0120.00416.90
8.0.20.0060.01317.24
8.0.00.0080.01016.72
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.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