3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { function __construct() { a = "hello"; b = "hi"; 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.3.0 - 5.3.28, 5.4.0 - 5.4.24
Parse error: syntax error, unexpected '=' in /in/9D4Ei on line 5
Process exited with code 255.

preferences:
188.45 ms | 1399 KiB | 61 Q