3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?hh class Value<T> { public function __construct(private T $value) {} public function get(): T { return $this->private; } } class Constraint { public function isEqual<T>(T $valueOne, T $valueTwo) { return ($valueOne == $valueTwo) } } $cons = new Constraint(); var_dump($cons->isEqual(1,2)); var_dump($cons->isEqual("hello", "hello"));
Output for 5.4.34 - 5.4.35
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/OPuM1 on line 3
Process exited with code 255.
Output for 5.4.0 - 5.4.32
<?hh class Value<T> { public function __construct(private T $value) {} public function get(): T { return $this->private; } } class Constraint { public function isEqual<T>(T $valueOne, T $valueTwo) { return ($valueOne == $valueTwo) } } $cons = new Constraint(); var_dump($cons->isEqual(1,2)); var_dump($cons->isEqual("hello", "hello"));