3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { /** @var array<string, string> */ private array $stuff = ["foo" => "foo"]; /** * @param non-empty-list<string> $param * @return string */ public function foo(array $param) { $arr = &$this->stuff[$param[0]]; // This seems to cause Psalm to blackout. var_dump($this->stuff); /** @var string */ $x = $arr; /** @psalm-trace $x, $arr */; // This trace doesn't work, and $x's type appears to be mixed at this point. /** @psalm-trace $x */ return $x; } } $foo = new Foo(); $foo->foo(["foo"]); $foo->foo(["bar"]);
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { ["foo"]=> &string(3) "foo" } array(2) { ["foo"]=> string(3) "foo" ["bar"]=> &NULL }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

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


preferences:
143.93 ms | 405 KiB | 5 Q