3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function rev($str) { if ( ! $str ) { return; } return rev(substr($str,1)) . $str{0}; } function sum($arr) { if ( ! sizeof($arr) ) { return; } return sum(array_shift($arr)) + $arr[0]; } $a = array(5,4,7,8,9,3); echo sum($a); echo rev('hola mundos ninos');
Output for 5.3.7 - 5.6.28, 7.0.0 - 7.1.0
Warning: array_shift() expects parameter 1 to be array, integer given in /in/Op0hU on line 13 4sonin sodnum aloh
Output for hhvm-3.10.0 - 3.12.0
Warning: array_shift() expects parameter 1 to be an array or mutable collection in /in/Op0hU on line 13 4sonin sodnum aloh