3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class C { public string $a; public string $b; public function __construct($a, $b) { $this->a = $a; $this->b = $b; } } // test only a $c = new C("foo", null); var_dump($c->a === "foo"); // test only b $c = new C(null, "foo"); var_dump($c->b === "foo"); ?>
Output for 7.1.0RC3 - 7.1.0
Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/EKk50 on line 3
Process exited with code 255.
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.0.6
Parse error: syntax error, unexpected 'string' (T_STRING), expecting variable (T_VARIABLE) in /in/EKk50 on line 3
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
bool(true) bool(true)
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/EKk50 on line 3
Process exited with code 255.