3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public $bar; public function __toString() { return (string) $this->bar; } } $foo->bar = $foo; echo $foo;
based on q72bR
Output for 7.1.0 - 7.2.0
Notice: Undefined variable: foo in /in/ctLAq on line 11 Warning: Creating default object from empty value in /in/ctLAq on line 11 Recoverable fatal error: Object of class stdClass could not be converted to string in /in/ctLAq on line 13
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Notice: Undefined variable: foo in /in/ctLAq on line 11 Warning: Creating default object from empty value in /in/ctLAq on line 11 Catchable fatal error: Object of class stdClass could not be converted to string in /in/ctLAq on line 13
Process exited with code 255.
Output for 5.4.10 - 5.6.28
Warning: Creating default object from empty value in /in/ctLAq on line 11 Catchable fatal error: Object of class stdClass could not be converted to string in /in/ctLAq on line 13
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Strict Standards: Creating default object from empty value in /in/ctLAq on line 11 Catchable fatal error: Object of class stdClass could not be converted to string in /in/ctLAq on line 13
Process exited with code 255.