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; } $fptr = fopen(getenv("OUTPUT_PATH"), "w"); $a_count = intval(trim(fgets(STDIN))); $a = array(); for ($i = 0; $i < $a_count; $i++) { $a_item = intval(trim(fgets(STDIN))); $a[] = $a_item; } $b_count = intval(trim(fgets(STDIN))); $b = array(); for ($i = 0; $i < $b_count; $i++) { $b_item = intval(trim(fgets(STDIN))); $b[] = $b_item; } $result = mergeArrays($a, $b); var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ValueError: Path cannot be empty in /in/eRMRL:43 Stack trace: #0 /in/eRMRL(43): fopen('', 'w') #1 {main} thrown in /in/eRMRL on line 43
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.75 ms | 401 KiB | 8 Q