In PHP, multidimensional array search refers to searching a key=>value in a multilevel nested array. This search can be done either by the iterative or recursive approach.
Recursive Approach: Check if the key exists in a multidimensional array and the value of a key is equal to required one then the result stored in an array and also recur through each element.
Example: Program to search students whose name is “AMIT” in a multidimensional array and print result.
101 - AMIT
202 - AMIT
Iterative Approach: Below implementation is the iterative approach
Example: Program to search students who lives in “Delhi” in a multidimensional array and print result.
BOB - Delhi
AMIT - Delhi
ANMOL - Delhi
TONNY - Delhi
- PHP multidimensional array search by value
- Sort a multidimensional array by date element in PHP
- Convert multidimensional array to XML file in PHP
- How to check an array is multidimensional or not in PHP ?
- How to merge the duplicate value in multidimensional array in PHP ?
- Multidimensional Associative Array in PHP
- Multidimensional arrays in PHP
- Multidimensional Array in R
- Multidimensional Arrays in Java
- Perl | Multidimensional Hashes
- Perl | Multidimensional Arrays
- How to search by multiple key => value in PHP array ?
- Binary Search in PHP
- How to detect search engine bots with PHP ?
- How to search the max value of an attribute in an array object ?
- Search Engine Optimization (SEO) | Basics
- Mobile Search Engine Optimization (SEO)
- How to get card vertically centered between search bar and bottom of the viewport?
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.