3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface testi { public function getName() : string; } class A { public $name; public __construct(testi $testi) { $this->name = $testi->getName(); } } $A = new A(new class implements testi { public function getName() : string { return "HOHOI"; } } ); var_dump($A->name);
based on 9OKek
Output for 7.0.0
Parse error: syntax error, unexpected '__construct' (T_STRING), expecting variable (T_VARIABLE) in /in/YQl01 on line 10
Process exited with code 255.
Output for 5.3.20 - 5.6.16
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/YQl01 on line 4
Process exited with code 255.