3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyDAO { public $x = 1; public __construct() { $this->x = uniquid(); } } class MyAction { private $x = 1; public function run() { $args = func_get_args(); foreach ($args as $arg) if ($arg instanceof MyDAO) $x = $arg->x; echo $x; } } $action = new MyAcount(); $action->run(new MyDAO(5));
Output for 5.4.0 - 5.4.7
Parse error: syntax error, unexpected '__construct' (T_STRING), expecting variable (T_VARIABLE) in /in/t5b1O on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.17
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/t5b1O on line 6
Process exited with code 255.

preferences:
168.51 ms | 1395 KiB | 33 Q