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
- HTML | multiple Attribute
- How to set multiple background images using CSS?
- JQuery | Multiple ID selectors
- HTML | <select> multiple Attribute
- 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
- jQuery | multiple classes Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.