3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function first(string str): string { function nested() { } return str; } public function second(int i): int { return i; } } $t = new Test; echo $t->first(); echo $t->second();
Output for 5.6.8 - 5.6.16, 7.0.0
Parse error: syntax error, unexpected 'str' (T_STRING), expecting variable (T_VARIABLE) in /in/PCvtv on line 5
Process exited with code 255.
Output for 5.5.24 - 5.5.30
Parse error: syntax error, unexpected 'str' (T_STRING), expecting '&' or variable (T_VARIABLE) in /in/PCvtv on line 5
Process exited with code 255.

preferences:
200.92 ms | 1395 KiB | 24 Q