php - LINQ expressions? -


is there way use linq expressions in php? example, in c# can following:

list<string> names = new list<string>() {     "francisco",     "ronald",     "araújo",     "barbosa" };  var onename = names.where(x => x.equals("ronald")).firstordefault(); 

and in php, how following?

names **.where** (x => x.equals("ronald")) **.firstordefault()**; 

there few php libraries mimic functionalities of linq. examples are:

in phplinq code this:

$names = array("francisco", "ronald", "araújo", "barbosa");  $onename = from('$name')->in($names)             ->where('$x => $x == "ronald"')             ->firstordefault('$name'); 

or pinq takes different approach php 5.3+ closures:

$onename = \pinq\traversable::from($names)             ->where(function ($x) { return $x == 'ronald'; })             ->first(); 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -