3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyTable { private name; private id; public function __set($p, $v) { $this->{$p} = $v; return $this; } } $oMyTable = new MyTable(); $o = {$oMyTable->name = 'Felipe'}; var_dump($o); $o = $oMyTable->id = '2'; var_dump($o); ?>
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected 'name' (T_STRING), expecting variable (T_VARIABLE) in /in/kP2sc on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/kP2sc on line 5
Process exited with code 255.

preferences:
184.41 ms | 1395 KiB | 61 Q