3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = Array ( "0" => Array ( "0" => "45", "1" => "10013800805001", "2" => "1041-0567041700116" ), "1" => Array ( "0" => "46", "1" => "10640", "2" => "1041-0567041700318" ), "2" => Array ( "0" => "207", "1" => "10645", "2" => "03320103000052" ) ); $b = Array ( "0" => Array ( "0" => "03320103000052", "1" => "0" ), "1" => Array ( "0" => "10013800805001", "1" => "12" ), "2" => Array ( "0" => "1090-0360141758201", "1" => "3" ) ); $c = array(); foreach($a as $values) { foreach($values as $value) { foreach($b as $val) { foreach($val as $vals) { if($vals == $value) { $c[] = array_unique(array_merge($values,$val)); } } } } } print_r($c);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => 45 [1] => 10013800805001 [2] => 1041-0567041700116 [4] => 12 ) [1] => Array ( [0] => 207 [1] => 10645 [2] => 03320103000052 [4] => 0 ) )