Phanix
Phanix

Just writing

php LINQ suite installation and use

LINQ is a technology introduced by Microsoft since .Net Framework 3.5, which is especially convenient for data collection query. Although the execution speed is slower than writing it in a loop, the code can be greatly reduced and maintenance is much easier.

Because LINQ can only be used in .Net Framework, the default php does not have this thing, but there are many people on github who have contributed their own versions, such as YaLinqo, Ginq, Pinq, etc., and then some people have done performance tests , the results It is YaLinqo: Yet Another LINQ to Objects for PHP that performs the best.

Installation is through composer, which is quite easy

 composer require athari/yalinqo

After installation, it will be under the vendor directory. If you want to use it, just add it at the beginning.

 require_once BASE_PATH . '/vendor/autoload.php';

Then it can be used, e.g. like this

 $assets[$i]['catlist'] = from($cattree)->where('$v["categoryid"] == ' . $c["categoryid"])->select('$v[" categoryname"]')->first();

Original link: Phanix's Blog

CC BY-NC-ND 2.0

Like my work?
Don't forget to support or like, so I know you are with me..

Loading...

Comment