3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php final class Foo { private $foo; public function __construct(string $foo) { $this->foo = $foo; } public function getFoo(): string { return $this->foo; } } $foo = new Foo('bar'); var_dump($foo->getFoo()); $foo->__construct('baz'); var_dump($foo->getFoo());
Output for hhvm-3.11.1 - 3.22.0, 7.0.0 - 7.3.4
string(3) "bar" string(3) "baz"
Output for hhvm-3.10.1
Fatal error: Syntax only allowed in Hack files (<?hh) or with -v Eval.EnableHipHopSyntax=true in /in/hHHvL on line 12
Process exited with code 255.
Output for 5.1.0 - 5.6.40
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/hHHvL on line 12
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected ':', expecting '{' or ';' in /in/hHHvL on line 12
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/hHHvL on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_CLASS in /in/hHHvL on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/hHHvL on line 3
Process exited with code 255.