3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class foo { function __construct() { $sally->a = "hello"; $sally->b = "hi"; $sally->val = "howdy"; $val = 'a'; echo $sally->{$val}; // outputs "hello" echo "\n"; $val = "b"; echo $sally->{$val}; // outputs "hi" echo "\n"; echo $sally->val; //outputs "howdy" echo "\n"; echo $sally->{"val"}; } } $foo = new foo();
Output for 5.4.0 - 7.1.0
Warning: Creating default object from empty value in /in/5Ot80 on line 5 hello hi howdy howdy
Output for 5.0.0 - 5.3.29
Strict Standards: Creating default object from empty value in /in/5Ot80 on line 5 hello hi howdy howdy
Output for 4.3.0 - 4.4.9