During my time working in PHP, I have often found my self needing to search for a matching row in a multi-dimensional array but found that the built in functions of PHP a bit lacking, until I found this solution. Say we have a multi-dimensional array like this The way to search a 1d array would be to use the function array_search(‘foo’, $array) but as you may see this doesn't work with a 2d array. To solve this in the past I would have written a function like so Which does work but writing your own search function for every project that requires it, is not the greatest solution.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.