3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; $strLength = strlen($string); $strLengthHalf = intval(strlen($string) / 2); for ($i = 0; $i <= $strLengthHalf; $i++) { $substr1 .= $string[$strLength-$i]; $substr2 .= $string[$strLengthHalf - $i]; } return $string = $substr1.$substr2; } var_dump(reverse('12345'));
based on lbcIE
Output for 5.2.10 - 7.1.10
Notice: Uninitialized string offset: 5 in /in/gfS8J on line 9 string(5) "54321"
Output for 4.3.0 - 5.2.9
Notice: Uninitialized string offset: 5 in /in/gfS8J on line 9 string(5) "54321"