2 つの配列の交差を返します
A 配列
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> array( [0] => array( ['action_id'] => 3 ) [1] => array( ['action_id'] => 2 ) [2] => array( ['action_id'] => 1 ) [3] => array( ['action_id'] => 7 ) [4] => array( ['action_id'] => 11 ) )
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> array( [0] => array( ['action_id'] => 3 ['type'] => 0 ['order_num'] => 67 ) [1] => array( ['action_id'] => 2 ['type'] => 0 ['order_num'] => 66 ) [2] => array( ['action_id'] => 1 ['type'] => 0 ['order_num'] => 65 ) [3] => array( ['action_id'] => 7 ['type'] => 0 ['order_num'] => 64 ) [8] => array( ['action_id'] => 14 ['type'] => 0 ['order_num'] => 40 ) [13] => array( ['action_id'] => 11 ['type'] => 0 ['order_num'] => 30 ) )
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> array( [0] => array( ['action_id'] => 3 ['type'] => 0 ['order_num'] => 67 ) [1] => array( ['action_id'] => 2 ['type'] => 0 ['order_num'] => 66 ) [2] => array( ['action_id'] => 1 ['type'] => 0 ['order_num'] => 65 ) [3] => array( ['action_id'] => 7 ['type'] => 0 ['order_num'] => 64 ) )
$a = 配列( 0 => 配列('アクションID' => 3)、 1 => 配列('アクションID' => 2)、 2 => 配列('アクションID' => 1)、 3 => 配列('アクションID' => 7)、 4 => 配列('アクションID' => 11)、 ); $b = 配列( 0 => array('action_id' => 3, 'type' => 0, 'order_num' => 67), 1 => array('action_id' => 2, 'type' => 0, 'order_num' => 66), 2 => array('action_id' => 1, 'type' => 0, 'order_num' => 65), 3 => array('action_id' => 7, 'type' => 0, 'order_num' => 64), 8 => array('action_id' => 14, 'type' => 0, 'order_num' => 40), 13 => array('action_id' => 11, 'type' => 0, 'order_num' => 30), ); foreach($a as $v) $dict[] = $v['action_id']; foreach($b as $k=>$v) if(in_array($v['action_id'], $dict)) $c[$k] = $v; print_r($c); <div class="clear"></div>