union方法

将给定的数组添加到集合中。如果给定的数组中含有与原集合一样的键,则原集合的值不会被改变。

$collection = collect([1 => ['a'], 2 => ['b']]);

$union = $collection->union([3 => ['c'], 1 => ['b']]);

$union->all(); // [1 => ['a'], 2 => ['b'], 3 => ['c']]
Copyright © http://blog.webfsd.com 2018 all right reserved,powered by Gitbook该文件修订时间: 2019-05-21 04:55:26

results matching ""

    No results matching ""