3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { private $notifier; public function __construct(callable $notifier) { $this->notifier = $notifier; } private function setTtl($time) { call_user_func($this->notifier, $time); } } class Pool { private $ttls = []; public function getItem($id) { return new Item(function ($ttl) use ($id) { $this->ttls[$id] = $ttl; }); } public function getTtl($id) { return $this->ttls[$id]; } } $pool = new Pool; $item = $pool->getItem('foo'); $item->setTtl(60); echo $pool->getTtl('foo');
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to private method Item::setTtl() from global scope in /in/9183Y:39 Stack trace: #0 {main} thrown in /in/9183Y on line 39
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:
60.3 ms | 401 KiB | 8 Q