a implementation of linq to array
a branche of the libarary Plinq(http://plinq.codeplex.com/license) which is a implementation of linq to array.
基于Plinq(http://plinq.codeplex.com/license) 修改的一个以linq方式操作数组的php类., (*1)
This branche of the libaray trying to implemente the same feature without using SPL RecursiveArrayIterator;br/ 这个分支试图在不依赖SPL RecursiveArrayIterator 这个标准库的情况下,实现与原Plinq同样的功能, (*2)
include('Alinq.php'); $alinq = new Alinq($array); $otherAlinq = $alinq->Instance($newArray);
include('Alinq.php'); $alinq = new Alinq($array); $result = $alinq->Select(function($k, $v){ return $v['int']; })->ToArray();
Instance()
Single()
GroupBy()
Concat()
SelectMany()
Select()
Where()
Skip()
Take()
All()
Any()
Average()
OrderBy()
OrderByDescending()
Max()
Min()
count()
Distinct()
Intersect()
Diff()
ElementAt()
First()
Last()
Array2DInverse()
ToArray()
include('Alinq.php'); $p = new Plinq($testArray); $result = $p->Where(function($k, $v){ return ($v['int'] > 998); })->ToArray();
install phpunit, (*3)
wget https://phar.phpunit.de/phpunit.phar chmod +x phpunit.phar sudo mv phpunit.phar /usr/local/bin/phpunit
run phpunit, (*4)
phpunit --verbose test/AlinqTest.php