Is there a function that allows me to search inside a multidimensional array that goes multiple levels deep? An example of an array can be found below.
What I want is to be able to search in the entire array, regardless of how deep it goes (3 levels deep would be the practical limit though). The search must be done in all of the strings inside the array elements, and to make it even more complex, it needs to be able to find parts of a string in the array (preferably case insensitive).
I’ve searched for a good class or function that can handle this in a fast and efficient way, but haven’t found one so far.
Array
(
[0] => Array
(
[OrderReferenceNumber] => 201100196
[OrderCustomerID] => 01239123
[OrderCustomerName] => test
[OrderHistoryItems] => Array
(
[0] => Array
(
[OrderItem] => productID
[OrderItemGroup] => productName
)
)
)
Much appreciated!
This will search all elements on all levels of the array, and the search is case sensitive. Just pass the search term and the array to search.