3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = [ 'total' => '5', '_embedded' => [ 'articles' => function() { yield "Article 1"; } ], 'more' => [ 'nested' => [ 'news' => function() { yield "Article 2"; } ], ], ]; $generators = []; $count = 0; array_walk_recursive($items, function (&$item, $key) use (&$count, &$generators) { if (is_callable($item)) { $placeholder = '__placeholder_' . $count . '__'; $generators[$placeholder] = $item; $item = $placeholder; ++$count; } }); var_dump($items); var_dump($generators);
Output for git.master_jit, git.master, rfc.property-hooks
array(3) { ["total"]=> string(1) "5" ["_embedded"]=> array(1) { ["articles"]=> string(17) "__placeholder_0__" } ["more"]=> array(1) { ["nested"]=> array(1) { ["news"]=> string(17) "__placeholder_1__" } } } array(2) { ["__placeholder_0__"]=> object(Closure)#1 (0) { } ["__placeholder_1__"]=> object(Closure)#2 (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:
25.82 ms | 406 KiB | 5 Q