Laravel 8 Arr::where() {#collection-method}
Arr::where
函数使用给定闭包返回的结果过滤数组:
use Illuminate\Support\Arr;
$array = [100, '200', 300, '400', 500];
$filtered = Arr::where($array, function ($value, $key) {
return is_string($value);
});
// [1 => '200', 3 => '400']