3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; for ($i = 0; $i < (strlen($string) / 2); $i++) { $substr1 += $string[strlen($string-$i)]; $substr2 += $string[$i]; } return $string = $substr1 + $string2; } reverse('12345');
based on 6mcbo
Output for 7.1.0
Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Warning: A non-numeric value encountered in /in/Svu4Z on line 6 Warning: A non-numeric value encountered in /in/Svu4Z on line 6 Warning: A non-numeric value encountered in /in/Svu4Z on line 7 Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Warning: A non-numeric value encountered in /in/Svu4Z on line 6 Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Warning: A non-numeric value encountered in /in/Svu4Z on line 6 Notice: Undefined variable: string2 in /in/Svu4Z on line 9
Output for 5.2.10 - 5.6.28, 7.0.0 - 7.0.14
Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Notice: Undefined variable: string2 in /in/Svu4Z on line 9
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: string2 in /in/Svu4Z on line 9
Output for 5.0.4 - 5.2.9
Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Notice: Undefined variable: string2 in /in/Svu4Z on line 9
Output for 4.3.0 - 5.0.3
Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Notice: Uninitialized string offset: 5 in /in/Svu4Z on line 6 Notice: Undefined variable: string2 in /in/Svu4Z on line 9