3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?hh namespace Hack\Userid\Quickstart\First; class Box<T> { public function __construct(private T $elem) { } public function get(): T { return $this->elem; } } function get_int(): int { return 42; } function use_box(): void { $box = new Box(get_int()); $i = $box->get(); var_dump($i); } use_box();
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '<', expecting end of file in /in/o8fTA on line 2
Process exited with code 255.
Output for 5.5.24 - 5.5.31, 5.6.8 - 5.6.17
Parse error: syntax error, unexpected '<' in /in/o8fTA on line 2
Process exited with code 255.

preferences:
157.88 ms | 1395 KiB | 28 Q