Consider this:
One mySQL database that has tables and rows and data within it.
One array that has the same data.
Now normally, I would have a query like this for mySQL SELECT * FROM 'table' WHERE name LIKE '%abc%'
But I want to perform that same query on the array, without having to insert it yet. The only method that comes to mind is using array_search, but the syntax is different and the method is convoluted.
Is there a shortcut here?
You can’t use SQL with arrays, but one way you could do your example is using
array_filter():or if you are using PHP >= 5.3.0
See it in action on ideone
You can also try PHPLinq: