3v4l.org

run code in 300+ PHP versions simultaneously
<?php // This is the best that you can do in PHP without going into the weird // self-modifying code because of this: // https://wiki.php.net/rfc/uniform_variable_syntax // I've inclued two ways of doing it, one using concat (.) and one using method // calls (->). If the UVS thing passes we can replace the the zero-width space // in the Container class w/ an __invoke() call and all will be well. class Container { private $current_string = "g"; public function __invoke($str = null) { if ($str !== null) { return $this->current_string . $str; } $this->current_string .= "o"; return $this; } } function gg($str = null) { if ($str === "al") { return "gal"; } return new Container(); } function g($str = null) { return "g" . $str; } function ​($str = null) { return $str ?: "o"; } return gg()()("al");
Output for git.master, git.master_jit, rfc.property-hooks

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