3v4l.org

run code in 200+ php & hhvm versions
<?php class X { function __toString() { return array(1,2,3); } } $x = new X; echo $x;
Output for 7.1.0 - 7.2.6
Recoverable fatal error: Method X::__toString() must return a string value in /in/gZT8v on line 10
Process exited with code 255.
Output for 5.2.0 - 7.0.20
Catchable fatal error: Method X::__toString() must return a string value in /in/gZT8v on line 10
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Method X::__toString() must return a string value in /in/gZT8v on line 10
Process exited with code 255.
Output for 4.3.0 - 4.4.9
Object