3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array(1,3,2,8,5,7,4,0); $array_length = count($arr); for ($i=0; $i<$array_length; $i++) { for ($j=0; $j<$array_length-1-$i; $j++) { if ($arr[$j+1] < $arr[$j]) { $tmp = $arr[$j]; $arr[$j] = $arr[$j+1]; $arr[$j+1] = $tmp; } } } var_dump(arr);
Output for 7.2.0 - 7.3.0rc4
Warning: Use of undefined constant arr - assumed 'arr' (this will throw an Error in a future version of PHP) in /in/1AeuN on line 13 string(3) "arr"
Output for 4.3.0 - 7.1.20
Notice: Use of undefined constant arr - assumed 'arr' in /in/1AeuN on line 13 string(3) "arr"