3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function joinNumbers($a, $b) { $t=10; while($b>=$t) $t*=10; return $a*$t+$b; } function arrangeNumbers() { $a = [1,34,3,98,9,76,45,4]; $size=count($a)/count($a[0]); for($i=0;$i<$size-1;$i++) for($j=$i+1;$j<$size;$j++) if(joinNumbers($a[$i],$a[$j])<joinNumbers($a[$j],$a[$i])) swap($a[$i],$a[$j]); printf("Number is : "); for($i=0;$i<$size;$i++) printf("%d",$a[$i]); printf("\n\n"); } arrangeNumbers();
based on B0SB1
Output for 7.2.0
Warning: count(): Parameter must be an array or an object that implements Countable in /in/GuuYD on line 15 Fatal error: Uncaught Error: Call to undefined function swap() in /in/GuuYD:20 Stack trace: #0 /in/GuuYD(29): arrangeNumbers() #1 {main} thrown in /in/GuuYD on line 20
Process exited with code 255.
Output for 7.0.0 - 7.1.10
Fatal error: Uncaught Error: Call to undefined function swap() in /in/GuuYD:20 Stack trace: #0 /in/GuuYD(29): arrangeNumbers() #1 {main} thrown in /in/GuuYD on line 20
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Fatal error: Call to undefined function swap() in /in/GuuYD on line 20
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/GuuYD on line 13
Process exited with code 255.