3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A0 { public function __toString() { return 'a0'; } }; class A1 extends A0 { public function __toString() { return 'a1'; } }; $a = function ($a) : A0 {return $a;}; echo '' . $a((new A0())), '' . $a((new A1()));
based on 5WXK8
Output for 7.0.0 - 7.2.0
a0a1
Output for 5.5.0 - 5.6.28
Parse error: syntax error, unexpected ':', expecting '{' in /in/HrSmh on line 5
Process exited with code 255.