3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); namespace App; use Generator; use CachingIterator; class Foo {} $generator = /** * @return Generator<bool, bool> */ static function (): Generator { yield true => true; yield false => false; yield "foo" => new Foo(); yield "bar" => new Foo(); yield "baz" => new Foo(); }; $iterator = new CachingIterator($generator(), CachingIterator::FULL_CACHE | CachingIterator::CALL_TOSTRING); foreach ($iterator as $k => $v) { var_dump($k, $v); } foreach ($iterator->getCache() as $k => $v) { var_dump($k, $v); }
Output for git.master, rfc.property-hooks
bool(true) bool(true) bool(false) bool(false) Warning: Uncaught Error: Object of class App\Foo could not be converted to string in /in/0LIrS:26 Stack trace: #0 /in/0LIrS(26): CachingIterator->next() #1 {main} thrown in /in/0LIrS on line 26 Fatal error: Out of memory (allocated 35651584 bytes) (tried to allocate 4096 bytes) in /in/0LIrS on line 20 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for git.master_jit
bool(true) bool(true) bool(false) bool(false) Warning: Uncaught Error: Object of class App\Foo could not be converted to string in /in/0LIrS:26 Stack trace: #0 /in/0LIrS(26): CachingIterator->next() #1 {main} thrown in /in/0LIrS on line 26 Fatal error: Out of memory (allocated 18874368 bytes) (tried to allocate 4096 bytes) in /in/0LIrS on line 20 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
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:
42.96 ms | 407 KiB | 5 Q