3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ 1 => "tenants", 2 => "modules", ]; $array2 = [ "child" => [ "prefix" => "tenants", "slug" => "tenants", "child" => [ [ "prefix" => "modules/{id}", "slug" => "modules" ], [ "prefix" => "fetch/{id}", "slug" => "fetch" ], ], ], ]; $res = []; $result =[]; foreach ($array1 as $asd) { array_walk_recursive($array2['child'], function ($item, $key) use (&$result, &$res, &$asd) { if ($key == "slug") { if ($item == $asd) { $res[] = $item; } } if ($key == 'prefix') { $result[] = $item; } }); } print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => tenants [1] => modules/{id} [2] => fetch/{id} [3] => tenants [4] => modules/{id} [5] => fetch/{id} )

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