Array 1 ($allmodels)
Array ( [0] => Array ( [id] => 6 )
[1] => Array ( [id] => 7 )
[2] => Array ( [id] => 8 ) )
Array 2 ($existmodels)
Array ( [0] => Array ( [id] => 6 )
[1] => Array ( [id] => 4 )
[2] => Array ( [id] => 7 )
[3] => Array ( [id] => 5 ) )
What I want as output array is(get the remaining models using $allmodels – $existmodels )
Array ( [0] => Array ( [id] => 8 ))
I tried
array_diff($allmodels,$existmodels); AND array_diff_assoc($allmodels,$existmodels); which both result
Array ( )
Can anyone tell me how can I get it done ?
Note of array_diff:
The string representation of array is both
Array, so this is the reason why you get empty array as result.You could use array_filter instead.