3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function quicksort( $array ) { if( count( $array ) < 2 ) { return $array; } $left = $right = array( ); reset( $array ); $pivot_key = key( $array ); $pivot = array_shift( $array ); foreach( $array as $k => $v ) { if( $v < $pivot ) $left[$k] = $v; else $right[$k] = $v; } return array_merge(quicksort($left), array($pivot_key => $pivot), quicksort($right)); } //Using quicksort() $array = quicksort( $array ); //returns sorted array.
Output for 7.2.0 - 7.3.0rc4
Notice: Undefined variable: array in /in/tXsnK on line 20 Warning: count(): Parameter must be an array or an object that implements Countable in /in/tXsnK on line 3
Output for 5.0.4 - 5.0.5, 5.1.1 - 7.1.20
Notice: Undefined variable: array in /in/tXsnK on line 20
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/tXsnK on line 20
Process exited with code 255.
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: array in /in/tXsnK on line 20