3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.2.8
number1array(3) { [0]=> string(7) "number1" [1]=> string(1) "b" [2]=> string(1) "c" } 9000.99number2array(3) { [0]=> string(7) "number1" [1]=> string(1) "b" [2]=> string(1) "c" }