3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ReceiveSomething { public int $target { set; } } class foo implements ReceiveSomething { public int $target; public function __construct() { echo $this->target; } } // emulate new instance $x = new ReflectionClass(foo::class); $instance = $x->newinstancewithoutconstructor(); $instance->target = 1; $instance->__construct();
Output for 8.4.1 - 8.4.10
1
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.23
Parse error: syntax error, unexpected token "{", expecting "," or ";" in /in/srdM6 on line 4
Process exited with code 255.

preferences:
173.85 ms | 1004 KiB | 7 Q