标签: yalinqo

在where子句中发送变量LINQ PHP

对于 PHP 中的 LINQ,我使用了https://github.com/Athari/YaLinqo

我不知道如何在where子句中传递变量。

public function filter($arr, $find) {
   Enumerable::from($arr)->where(function($val) { return stripos($val->item, $find) > -1; })->toArray();
}
Run Code Online (Sandbox Code Playgroud)

似乎没有像$find未定义那样工作,但我将它作为方法的参数发送。

php linq anonymous-function yalinqo

5
推荐指数
1
解决办法
338
查看次数

标签 统计

anonymous-function ×1

linq ×1

php ×1

yalinqo ×1