3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function str_reverse($string) { if (! is_string ( $string )) { exit ( 'not string' ); } $length = strlen ( $string ); $str_array = str_split ( $string ); $str_reverse = ''; for($i = $length - 1; $i >= 0; $i --) { $str_reverse .= $str_array [$i]; } echo $str_reverse; } $str = 'abcdef ss '; echo str_reverse ( $str );
Output for 5.0.0 - 7.1.0
ss fedcba
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_split() in /in/FEZNJ on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: str_split() in /in/FEZNJ on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_split() in /in/FEZNJ on line 7