ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# reject方法 使用指定的回调过滤集合。如果回调返回`true`,就会把对应的项目从集合中移除。 与`filter`放相反 ~~~ $collection = collect([1, 2, 3, 4]); $filtered = $collection->reject(function ($value, $key) { return $value > 2; }); $filtered->all(); // [1, 2] ~~~ 与`reject()`相反的方法,查看[filter](https://ihavenolimitations.xyz/collections/filter.md)方法。