3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'a' => array( 'a' => 'apple', 'b' => 'banana', 'c' => 'cranberry', 'd' => 'mango', 'e' => 'pineapple' ), 'b' => array( 'a' => 'apple', 'b' => 'banana', 'c' => 'cranberry', 'd' => 'mango', 'e' => 'pineapple' ), 'c' => 'cranberry', 'd' => 'mango', 'e' => 'pineapple' ); function test(&$child, $entry) { $i = 1; foreach ($child AS $key => $fruit) { if (!is_numeric($key)) { $child[$i] = $fruit; unset($child[$key]); $i++; } } } $i = 1; foreach ($arr AS $key => $fruit) { $arr[$i] = $fruit; if (is_array($fruit)) { test($arr[$i], $fruit); } unset($arr[$key]); $i++; } var_dump($arr);
Output for git.master, git.master_jit, rfc.property-hooks
array(5) { [1]=> array(5) { [1]=> string(5) "apple" [2]=> string(6) "banana" [3]=> string(9) "cranberry" [4]=> string(5) "mango" [5]=> string(9) "pineapple" } [2]=> array(5) { [1]=> string(5) "apple" [2]=> string(6) "banana" [3]=> string(9) "cranberry" [4]=> string(5) "mango" [5]=> string(9) "pineapple" } [3]=> string(9) "cranberry" [4]=> string(5) "mango" [5]=> string(9) "pineapple" }

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.63 ms | 402 KiB | 8 Q