3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $secret = 'Nyy lbhe Onfr ner orybat gb hf.'; private $callback; final public function run() { call_user_func($this->callback); return $this->secret . PHP_EOL; } public function __set($k, $v) { $key = $v[($v[$v])]; // $v is some kind of weird array $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; class MakeYourTime extends ArrayObject { public function __construct($test) { $this->test = $test; } public function __invoke() { $closure = function() { $this->secret = str_rot13($this->secret); }; return $closure->bindTo($this->test, 'Test'); } public function offsetGet($index) { return 'callback'; } } $test->cats = new MakeYourTime($test); echo $test->run();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of MakeYourTime::offsetGet($index) should either be compatible with ArrayObject::offsetGet(mixed $key): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/uD1cJ on line 41 Deprecated: Creation of dynamic property MakeYourTime::$test is deprecated in /in/uD1cJ on line 29 All your Base are belong to us.

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:
48.04 ms | 402 KiB | 8 Q