3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array('4','2','3','0'); echo "<pre>";print_r($array); function bubble_sort($arr){ $count = $arr; for($i=0;$i<$count;$i++){ for($j=0;$j<$count-1-$i;$j++){ if($arr[$j+1]<$arr[$j]){ swap($arr,$j,$j++); } } } return $arr; } fuction swap(&$arr,$a,$b){ $temp = $arr[$a]; $arr[$a] = $arr[$b]; $arr[$b] = $temp; } $array1 = bubble_sort($array); print_r($array1);
Output for 5.4.0 - 5.4.31
Parse error: syntax error, unexpected 'swap' (T_STRING) in /in/YYXkW on line 31
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING in /in/YYXkW on line 31
Process exited with code 255.