3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class User { public $username = 'user'; public $test; } class Test { public $here = 'here'; } $user = new User; $test = new Test; $user->test = $test; $string = 'username'; var_dump($user->$string); echo '<br>'; $string = 'test'; var_dump($user->test); echo '<br>'; $string = 'test->here'; echo $user->$string;

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
string(4) "user" <br>object(Test)#2 (1) { ["here"]=> string(4) "here" } <br> Notice: Undefined property: User::$test->here in /in/fAJ9P on line 26
Output for Array change keys
string(4) "user" <br>object(Test)#2 (1) { ["here"]=> string(4) "here" } <br> Notice: Undefined property: User::$test->here in /in/fAJ9P on line 26
Output for Lexical anon
string(4) "user" <br>object(Test)#2 (1) { ["here"]=> string(4) "here" } <br> Notice: Undefined property: User::$test->here in /in/fAJ9P on line 26

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page