I've been trying to get this for hours now.
I have two multidimensional arrays
$newData (
[0] => Array(
[id] => 1
[name] => John
[sex] => male
)
[1] => Array(
[id] => 2
[name] => Kenny
[sex] => male
)
[2] => Array(
[id] => 3
[name] => Sarah
[sex] => female
)
[3] => Array(
[id] => 4
[name] => George
[sex] => male
)
)
$oldData (
[0] => Array(
[id] => 3
[name] => Sarah
[sex] => female
)
[1] => Array(
[id] => 4
[name] => George
[sex] => male
)
[2] => Array(
[id] => 5
[name] => Peter
[sex] => male
)
[3] => Array(
[id] => 6
[name] => Lexi
[sex] => female
)
)
I need to compare $newData and $oldData and grab only the new data that is before the first common array.
My $newData will then be:
$newData (
[0] => Array(
[id] => 1
[name] => John
[sex] => male
)
[1] => Array(
[id] => 2
[name] => Kenny
[sex] => male
)
)
I've tried everything from array_unique, if comparing the ID keys but nothing is working properly.
Do I need to merge them, first? map them? Bahh, I have no idea, I am so lost.
Any help would be awesome