3v4l.org

run code in 300+ PHP versions simultaneously
<?php class xiter extends ArrayIterator { public function as_array() { var_dump(__METHOD__); return iterator_to_array($this); } } class fiter extends FilterIterator { public function accept() { return $this->getInnerIterator()->current() % 2 == 0; } } $iter = new xiter(array(1, 2, 3, 4)); $fiter = new fiter($iter); foreach ($iter as $i) var_dump($i); foreach ($fiter as $i) var_dump($i); var_dump($iter->as_array()); var_dump($fiter->as_array()); var_dump($fiter->as_array2());
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of fiter::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/QLpk8 on line 12 int(1) int(2) int(3) int(4) int(2) int(4) string(15) "xiter::as_array" array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) } string(15) "xiter::as_array" array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) } Fatal error: Uncaught Error: Call to undefined method xiter::as_array2() in /in/QLpk8:26 Stack trace: #0 {main} thrown in /in/QLpk8 on line 26
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:
47.37 ms | 402 KiB | 8 Q