c9s / xarray

The missing PHP array functions you are looking for, implemented in extension
42 stars 3 forks source link

array_only #5

Open c9s opened 9 years ago

c9s commented 9 years ago

https://github.com/laravel/framework/blob/master/src%2FIlluminate%2FSupport%2FArr.php#L143

    /**
     * Get a subset of the items from the given array.
     *
     * @param  array  $array
     * @param  array|string  $keys
     * @return array
     */
    public static function only($array, $keys)
    {
        return array_intersect_key($array, array_flip((array) $keys));
    }