PHP Search through array A for matching id from array B Then print data from array B

Mistah Fox

New Member
Here's what the first array outputs:\[code\]Array ( [0] => Array ( [id] => 67 [title] => avatar delete any ) [1] => Array ( [id] => 66 [title] => avatar edit any ) [2] => Array ( [id] => 65 [title] => avatar upload ) [3] => Array ( [id] => 8 [title] => comments edit own ) [4] => Array ( [id] => 6 [title] => comments post ) [5] => Array ( [id] => 9 [title] => comments remove own ) [6] => Array ( [id] => 7 [title] => comments vote ) [7] => Array ( [id] => 5 [title] => get other members emails )[8] => Array ( [id] => 1 [title] => send greetings ) [9] => Array ( [id] => 4 [title] => send messages ) [10] => Array ( [id] => 64 [title] => use flip chat ) [11] => Array ( [id] => 11 [title] => videos add ) [12] => Array ( [id] => 13 [title] => videos approve ) [13] => Array ( [id] => 12 [title] => videos delete ) [14] => Array ( [id] => 14 [title] => videos edit ) [15] => Array ( [id] => 10 [title] => videos view ) [16] => Array ( [id] => 2 [title] => view profiles ) [17] => Array ( [id] => 3 [title] => vote ) )\[/code\]The Second array outputs this:\[code\]Array ([2] => Array ( [id] => 2 [title] => view profiles [AllowedCount] => 5 [AllowedPeriodLen] => 5 ) [3] => Array ( [id] => 3 [title] => vote [AllowedCount] => 0 [AllowedPeriodLen] => 0 ) )\[/code\]I'm using a foreach to loop through the first array to display actions that are enabled. How would I check if the Key of the second array matches the key of the First, then give variables values from AllowedCount, and AllowedPeriodLen?
 
Back
Top