I've been struggling for a while now. I have 2 arrays that I want to compare with each other. A user array and a lesson array. The Keys in the lesson array are the ID's of that lesson
Lesson Array:
Array(
// The key in this array ([143] or [13]) is the lesson ID each lesson contains one ore more topics
[143] => Array (
[0] => 315 // example: 315 is a topic ID within lesson 143
[1] => 311
[2] => 176
[3] => 145
)
[13] => Array (
[0] => 27
[1] => 25
)
)
The user array contains only the information about which topics that user has completed. Topic with lesson ID's that are not completed don't exist in this array.
Main question: I want to compare the topic ID's of the user array to the Lesson array. And I want to put the topics that aren't completed in a seperate array.
User array
Array (
[0] => Array (
[143] => Array (
[145] => 1 // (this 1 means it is completed, this key is a topic ID)
[176] => 1
)
)
[1] => Array (
[13] => Array (
[25] => 1
)
)
)
In this example above the result i want to get is an array with non matching id's like:
$result = array( 143 => array(311,315), 13 => array(27))
I hope it's a little bit clear.
If anyone can point me out in the right direction I'll be very glad! I tried a lot of things but to post them all here it's not clarifying the main question.