3v4l.org

run code in 150+ 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 - 5.6.28, 7.0.0 - 7.1.0
Notice: Uninitialized string offset: 5 in /in/gfS8J on line 9 string(5) "54321"
Output for hhvm-3.10.0 - 3.12.0
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"