I have a bidimensional array in php like this:
Array (
[0] => Array
(
[index1] => -1
[index2] => 77
[description] => 7
)
[1] => Array
(
[index1] => -1
[index2] => 77
[description] => 5
)
[2] => Array
(
[index1] => -1
[index2] => 78
[description] => 12
)
)
I need to find if there is a duplicate between the first level arrays.
But only considering the keys index1 and index2.
In the example above, it should return true because 0 and 1 have the same index1 and index2.
No need for nested loops or complete walks (or even multiple walks) over the array, which btw is what most of the suggested array_something functions do internally. Iterate once and stop when you see an element that you’ve seen before.