3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo extends IteratorIterator { function __construct( $items ) { if ( is_array( $items ) ) { $items = new ArrayIterator( $items ); } } function __debugInfo() { return [ "count" => iterator_count( $this ) ]; } } $a = new Foo( [ 1,2,3 ] ); var_dump( $a ); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Uncaught Error: The object is in an invalid state as the parent constructor was not called in /in/tHteN:14 Stack trace: #0 [internal function]: IteratorIterator->rewind() #1 /in/tHteN(14): iterator_count(Object(Foo)) #2 [internal function]: Foo->__debugInfo() #3 /in/tHteN(19): var_dump(Object(Foo)) #4 {main} thrown in /in/tHteN on line 14 Fatal error: __debuginfo() must return an array in /in/tHteN on line 19
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:
61.12 ms | 401 KiB | 8 Q