3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function reverseString($string) { $l = strlen($string) - 1; for($i = 0, $j = $l, $e = $l / 2; $i < $e; $i++, $j--) { $string[$i] ^= $string[$j]; $string[$j] ^= $string[$i]; $string[$i] ^= $string[$j]; } return $string; } echo reverseString('fooooooooo');
Output for 7.1.0
Fatal error: Uncaught Error: Cannot use assign-op operators with string offsets in /in/Y6pDL:8 Stack trace: #0 /in/Y6pDL(16): reverseString('fooooooooo') #1 {main} thrown in /in/Y6pDL on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.14
Fatal error: Uncaught Error: Cannot use assign-op operators with overloaded objects nor string offsets in /in/Y6pDL:8 Stack trace: #0 /in/Y6pDL(16): reverseString('fooooooooo') #1 {main} thrown in /in/Y6pDL on line 8
Process exited with code 255.
Output for 4.3.2 - 5.6.28, hhvm-3.10.0 - 3.12.0
Fatal error: Cannot use assign-op operators with overloaded objects nor string offsets in /in/Y6pDL on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot use assign-op operators with overloaded objects nor string offsets in /in/Y6pDL on line 8