3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace A { class T {} } namespace { class Test { public function first(string $str) : Closure { return function() use (string $str) : int { return strlen($str); }; } public function second(): self { return $self; } } $t = new Test; echo ($t->seconf()->first("hello"))(); }
based on P8UfK
Output for 7.0.0
Parse error: syntax error, unexpected 'string' (T_STRING), expecting '&' or variable (T_VARIABLE) in /in/DJ7UR on line 12
Process exited with code 255.
Output for 5.3.20 - 5.6.16
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/DJ7UR on line 10
Process exited with code 255.