3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $str = "string"; function __construct(){ return $this->str; } } $Test = new Test(); echo $Test->[0]->$str;
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
Parse error: syntax error, unexpected '[', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/6I6Pl on line 12
Process exited with code 255.

preferences:
186.72 ms | 1387 KiB | 67 Q