3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ 'main' => [ 'number1' => '9000.99', 'number2' => 'nonono' ] ]; $arr2 = [ 'key1' => ['number1','b','c'] ]; function read($arr, $arr2) { foreach ($arr as $key => $value) { if (is_array($value)) { read($value, $arr2); } else { echo $key; foreach($arr2 as $action) { var_dump($action); if(array_key_exists($key, array_flip($action))){ echo $value; } } } } } read($arr1, $arr2);

preferences:
29.93 ms | 405 KiB | 5 Q