3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace A { class T {} } namespace { class Test { public function first(string $str) : Closure { /* closure with return type declaration and use() clause */ $tmp = function() use ($str) : int { return strlen($str); }; return $tmp; } public function second() : self { return $this; } } class SubTest extends Test { public function third() : parent { return $this; } /* returning a namespace-qualified type */ public function fourth() : \A\T { return new \A\T; } /* spaces are allowed around elements of the namespace */ public function fifth() : \ A \ T { return $this->fifth(); } } $s = new SubTest; $t = $s->third(); var_dump(($t->second()->first("hello"))()); var_dump($s->fourth()); var_dump($s->fifth()); }
Output for git.master, git.master_jit, rfc.property-hooks
Parse error: syntax error, unexpected token "\" in /in/VEveI on line 40
Process exited with code 255.

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:
59.19 ms | 401 KiB | 8 Q