Laravel 8 intersectByKeys() {#collection-method}
2021-07-19 09:39 更新
intersectByKeys
方法从原集合中移除在指定 array
或集合中不存在的任何键:
$collection = collect([
'serial' => 'UX301', 'type' => 'screen', 'year' => 2009,
]);
$intersect = $collection->intersectByKeys([
'reference' => 'UX404', 'type' => 'tab', 'year' => 2011,
]);
$intersect->all();
// ['type' => 'screen', 'year' => 2009]
以上内容是否对您有帮助:
更多建议: