Consider following scenario: You have a small MogoDB collection or a small MySQL table (contains 1000 record for example, it may be read-only too ) that is used extensively and repeatedly in your app.
You decide to fetch all of its content to a PHP array and use the array instead of sending a lot of query to DB.
In above scenario how can we retrieve some array items in a manner similar to retrieving records of a DB table in an efficient way? A PDO adapter for array or any other similar facility ...
There is port of famous C# LINQ library for php.
It gives you flexible oo interface to querying data sources.
http://phplinq.codeplex.com/wikipage?title=Examples&referringTitle=Home
Simple example
// Create data source
$names = array("John", "Peter", "Joe", "Patrick", "Donald", "Eric");
$result = from('$name')->in($names)
->where('$name => strlen($name) < 5')
->select('$name');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With