3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class foo { function __toString() { return "bar";}} $a = new foo(); echo $a; $bar = "hello"; echo $$a;
based on adoA2
Output for 5.2.0 - 7.1.0
barhello
Output for 5.0.4 - 5.1.6
bar Notice: Object of class foo to string conversion in /in/Kb9QZ on line 6 Notice: Undefined variable: Object in /in/Kb9QZ on line 6
Output for 5.0.0 - 5.0.3
bar Notice: Object of class foo to string conversion in /in/Kb9QZ on line 6 Notice: Undefined variable: Object in /in/Kb9QZ on line 6
Output for 4.3.0 - 4.4.9
Object Notice: Object to string conversion in /in/Kb9QZ on line 6 Notice: Undefined variable: Object in /in/Kb9QZ on line 6