Here’s what the first array outputs:
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 ) )
The Second array outputs this:
Array (
[2] => Array ( [id] => 2 [title] => view profiles [AllowedCount] => 5 [AllowedPeriodLen] => 5 )
[3] => Array ( [id] => 3 [title] => vote [AllowedCount] => 0 [AllowedPeriodLen] => 0 ) )
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?
i’d reconsider my array design
if the id is really a unique number then redesign the first array to be like that:
the second one like that
so that the line matches the id’s
then just do something like