In a multidimensional array, if there is no unique pair of key => value (more than one pair of key => value) exists then in that case if we search the element by a single key => value pair then it can return more than one items. Therefore we can implement the search with more than one key => value pair to get unique items.
Approach: For each array inside the array, iterate over the search array and if any search key value doesn’t match with corresponding array key value we discard that array and continue the process for next array. Let’s understand this better with an example:
Suppose we want to search student details from a list of the student which contains student of different section, therefore, in this case, rollNo alone might not give the correct output. So we will need to search the list with two key => value that is rollNO and section.
- How to search by key=>value in a multidimensional array in PHP ?
- PHP multidimensional array search by value
- Multiple Inheritance in PHP
- CSS | Multiple Columns
- JQuery | Multiple ID selectors
- HTML | multiple Attribute
- How to set multiple background images using CSS?
- How to Get $_POST from multiple check-boxes ?
- How to Add and Remove multiple classes in jQuery ?
- How to get multiple selected values of select box in php?
- How to return multiple values from function in PHP?
- HTML | DOM Select multiple Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.