3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { function __construct() { $this->a = "oooo"; $this->b = "hi"; $this->val = "howdy"; $val = a; echo $this->{$val}; // outputs "hello" echo "\n"; $val = "b"; echo $this->{$val}; // outputs "hi" echo "\n"; echo $this->val; //outputs "howdy" echo "\n"; echo $this->{"val"}; } } $foo = new foo();
based on UdeTq
Output for 7.2.0
Warning: Use of undefined constant a - assumed 'a' (this will throw an Error in a future version of PHP) in /in/uO18J on line 9 oooo hi howdy howdy
Output for 5.3.19 - 7.1.10
Notice: Use of undefined constant a - assumed 'a' in /in/uO18J on line 9 oooo hi howdy howdy