3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; $strLength = strlen($string); $strLengthHalf = round(strlen($string) / 2)-1; for ($i = 0; $i < round(strlen($string) / 2); $i++) { $substr1 .= $string[$strLength-$i]; $substr2 .= $string[$strLengthHalf - $i]; } var_dump($substr1); var_dump($substr2); return $string = $substr1.$substr2; } var_dump(reverse('12345'));
based on 8BcaF
Output for 5.4.5 - 5.6.28, 7.0.0 - 7.1.0
Notice: Uninitialized string offset: 5 in /in/tc5lJ on line 8 Notice: String offset cast occurred in /in/tc5lJ on line 9 Notice: String offset cast occurred in /in/tc5lJ on line 9 Notice: String offset cast occurred in /in/tc5lJ on line 9 string(2) "54" string(3) "321" string(5) "54321"
Output for hhvm-3.12.0
Notice: String offset cast occurred in /in/tc5lJ on line 9 Notice: String offset cast occurred in /in/tc5lJ on line 9 Notice: String offset cast occurred in /in/tc5lJ on line 9 string(2) "54" string(3) "321" string(5) "54321"
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.4.0 - 5.4.4
Notice: Uninitialized string offset: 5 in /in/tc5lJ on line 8 Notice: String offset cast occured in /in/tc5lJ on line 9 Notice: String offset cast occured in /in/tc5lJ on line 9 Notice: String offset cast occured in /in/tc5lJ on line 9 string(2) "54" string(3) "321" string(5) "54321"
Output for 5.2.10 - 5.3.29
Notice: Uninitialized string offset: 5 in /in/tc5lJ on line 8 string(2) "54" string(3) "321" string(5) "54321"
Output for 4.3.0 - 5.2.9
Notice: Uninitialized string offset: 5 in /in/tc5lJ on line 8 string(2) "54" string(3) "321" string(5) "54321"