mkloubert / php-linq
PHP 的 LINQ 概念。
dev-master
2019-10-30 05:38 UTC
This package is not auto-updated.
Last update: 2024-09-18 17:47:56 UTC
README
大多数方法在 .NET 上下文中都是可链式的。
特性
- Lambda 表达式
- 可以使用任何类型的 列表或迭代器
- 大多数方法在 .NET 上下文中都是可链式的
- 在 PHP 上下文中的增强/改进
要求
示例
完整列表可以在 实时示例页面 中找到。
use \System\Linq; $seq = Enumerable::fromValues(5979, 23979, null, 23979, 1781, 241279); $newSeq = $seq->select('$x => (string)$x') // transform all values // to string ->where('$x => !empty($x)') // filter out all values that are empty ->skip(1) // skip the first element ('5979') ->take(3) // take the next 3 elements from current position // ('23979', '23979' and '1781') ->distinct() // remove duplicates ->order(); // sort foreach ($newSeq as $item) { // [0] '1781' // [1] '23979' }
您需要
- phpLINQ.php 文件
- 整个 System 文件夹
文件/目录结构
System/
phpLINQ.php
已实现
- aggregate()
- all()
- any()
- average()
- cast()
- concat()
- contains()
- count()
- defaultIfEmpty()
- distinct()
- elementAt()
- elementAtOrDefault()
- except()
- first()
- firstOrDefault()
- groupBy()
- groupJoin()
- intersect()
- join()
- last()
- lastOrDefault()
- max()
- min()
- ofType()
- orderBy()
- orderByDescending()
- reverse()
- select()
- selectMany()
- sequenceEqual()
- single()
- singleOrDefault()
- skip()
- skipWhile()
- sum()
- take()
- takeWhile()
- toArray()
- toDictionary()
- toList()
- toLookup()
- union()
- where()
- zip()