3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function __toString() { return 1/0; } } $a = new A; echo (string)$a;
based on 1f92A
Output for 7.1.0
Warning: Division by zero in /in/QA1Al on line 5 Recoverable fatal error: Method A::__toString() must return a string value in /in/QA1Al on line 10
Process exited with code 255.
Output for 5.2.0 - 7.0.14
Warning: Division by zero in /in/QA1Al on line 5 Catchable fatal error: Method A::__toString() must return a string value in /in/QA1Al on line 10
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Object id #1
Output for 4.3.0 - 4.4.9
Notice: Object to string conversion in /in/QA1Al on line 10 Object