3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function sortiraj ($niz,$a,$b) { if ($a>=$b) { return $niz; } $sredina=($a+$b)/2; $prvapolovica=sortiraj($niz,$a,$sredina); $drugapolovica=sortiraj($niz,$sredina+1,$b); return spoji($prvapolovica,$drugapolovica); } function spoji($prvapolovica,$drugapolovica) { $i=0;$j=0;$k=0; while(($i<count($prvapolovica))||($j<count($drugapolovica))) { if (isset($prvapolovica[$i]) && isset($drugapolovica[$j])){ if($prvapolovica[$i]<$drugapolovica[$j]){ $konacno[$k]=$prvapolovica[$i];$i++;} else{ $konacno[$k]=$drugapolovica[$j]; $j++;} ++$k;} if (!isset($prvapolovica[$i])){ $konacno[$k]=$drugapolovica[$j]; $j++;++$k;} else if(!isset($drugapolovica[$j])){ $konacno[$k]=$prvapolovica[$i]; $i++;++$k;}} return $konacno; } $niz=array(45,07,36,47,37,84,35); echo sortiraj($niz,0,count($niz)-1);
based on v2Q6u
Output for 5.4.2 - 5.4.26, 5.4.31 - 7.3.0rc4
Notice: Array to string conversion in /in/clFon on line 35 Array
Output for 5.4.27 - 5.4.30

Process exited with code 137.
Output for 5.3.15 - 5.3.29
Array