3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SOS extends SplObjectStorage { public function key() { return parent::current(); } public function current() { return parent::getInfo(); } } $a = array('User' => array(1 => new SOS)); $a['User'][1]->attach(new StdClass, new StdClass); var_dump($a); foreach ($a['User'][1] as $actor => $entity) var_dump($actor, $entity);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of SOS::key() should either be compatible with SplObjectStorage::key(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/n94af on line 5 Deprecated: Return type of SOS::current() should either be compatible with SplObjectStorage::current(): object, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/n94af on line 10 array(1) { ["User"]=> array(1) { [1]=> object(SOS)#1 (1) { ["storage":"SplObjectStorage":private]=> array(1) { [0]=> array(2) { ["obj"]=> object(stdClass)#2 (0) { } ["inf"]=> object(stdClass)#3 (0) { } } } } } } object(stdClass)#2 (0) { } object(stdClass)#3 (0) { }

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:
40.2 ms | 403 KiB | 8 Q