3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testArray = ['a' => ['b' => 'l'], 'c' => 'm', 'd' => ['n' => 'o']]; $actionArray = ['b' => 'action']; function toUpperRecursive($arr, $actionArray) { foreach ($arr as $key => $val) { if (is_array($val)) { $newKey = strtoupper($key); $arr[$newKey] = toUpperRecursive($val, $actionArray); unset($arr[$key]); } elseif (is_string($val)) { foreach($actionArray as $actionKey => $action) { if($key === $actionKey) { $arr[$key] = $val . ' + 1111'; } } } } return $arr; } // echo "before:\n"; // var_export($testArray); // echo "after:\n"; // var_export(toUpperRecursive($testArray)); var_export(toUpperRecursive($testArray, $actionArray));
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'c' => 'm', 'A' => array ( 'b' => 'l + 1111', ), 'D' => array ( 'n' => 'o', ), )

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:
76 ms | 405 KiB | 5 Q