3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Test { public $foo=1; public $bar=2; public $foobar="3"; } $p1="foo"; $p2="bar"; $test=new Test(); echo $test->$p1.$p2; echo "\n"; echo ($test->$p1).$p2; echo "\n"; echo $test->($p1.$p2); echo "\n";
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/d8Okd on line 16
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' in /in/d8Okd on line 16
Process exited with code 255.