3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tap($target) { return new HigherOrderTapProxy($target); } class HigherOrderTapProxy { public $target; public function __construct($target) { $this->target = $target; } public function __call($method, $parameters) { $this->target->{$method}(...$parameters); return $this->target; } } class Number { public $value; public function __construct($value) { $this->value = $value; } public function add($value) { $this->value += $value; } public function get() { return $this->value; } } tap($number = new Number(5)) ->add(10) ->add(20); var_dump($number);
Output for git.master, git.master_jit, rfc.property-hooks
object(Number)#1 (1) { ["value"]=> int(35) }

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:
14.54 ms | 405 KiB | 5 Q