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());

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
string(3) "bar" string(3) "baz"
Output for Arrow functions
string(3) "bar" string(3) "baz"
Output for Object typehint
string(3) "bar" string(3) "baz"
Output for Array change keys
string(3) "bar" string(3) "baz"
Output for Lexical anon
Catchable fatal error: Argument 1 passed to Foo::__construct() must be an instance of string, string given, called in /in/hHHvL on line 18 and defined in /in/hHHvL on line 7

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page