Arr
class Arr (View source)
Traits
Methods
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Determine whether the given value is array accessible.
Add an element to an array using "dot" notation if it doesn't exist.
Build a new array using a callback.
Collapse an array of arrays into a single array.
Divide an array into two arrays. One with keys and the other with values.
Flatten a multi-dimensional associative array with dots.
Get all of the given array except for a specified array of items.
Determine if the given key exists in the provided array.
Return the first element in an array passing a given truth test.
Return the last element in an array passing a given truth test.
Flatten a multi-dimensional array into a single level.
Remove one or many array items from a given array using "dot" notation.
Get an item from an array using "dot" notation.
Check if an item exists in an array using "dot" notation.
Determines if an array is associative.
Get a subset of the items from the given array.
Pluck an array of values from an array.
Push an item onto the beginning of an array.
Get a value from the array, and remove it.
Set an array item to a given value using "dot" notation.
Sort the array using the given callback.
Recursively sort an array by keys and values.
Filter the array using the given callback.
Details
static
mixed
__callStatic(
string $method,
array $parameters)
Dynamically handle calls to the class.
at line line 18
static
bool
accessible(
mixed $value)
Determine whether the given value is array accessible.
at line line 31
static
array
add(
array $array,
string $key,
mixed $value)
Add an element to an array using "dot" notation if it doesn't exist.
at line line 49
static
array
build(
array $array,
callable $callback)
Build a new array using a callback.
at line line 68
static
array
collapse(
array $array)
Collapse an array of arrays into a single array.
at line line 91
static
array
divide(
array $array)
Divide an array into two arrays. One with keys and the other with values.
at line line 103
static
array
dot(
array $array,
string $prepend = '')
Flatten a multi-dimensional associative array with dots.
at line line 125
static
array
except(
array $array,
array|string $keys)
Get all of the given array except for a specified array of items.
at line line 139
static
bool
exists(
ArrayAccess|array $array,
string|int $key)
Determine if the given key exists in the provided array.
at line line 156
static
mixed
first(
array $array,
callable $callback = null,
mixed $default = null)
Return the first element in an array passing a given truth test.
at line line 179
static
mixed
last(
array $array,
callable $callback = null,
mixed $default = null)
Return the last element in an array passing a given truth test.
at line line 195
static
array
flatten(
array $array,
int $depth = INF)
Flatten a multi-dimensional array into a single level.
at line line 225
static
void
forget(
array $array,
array|string $keys)
Remove one or many array items from a given array using "dot" notation.
at line line 270
static
mixed
get(
ArrayAccess|array $array,
string $key,
mixed $default = null)
Get an item from an array using "dot" notation.
at line line 302
static
bool
has(
ArrayAccess|array $array,
string $key)
Check if an item exists in an array using "dot" notation.
at line line 335
static
bool
isAssoc(
array $array)
Determines if an array is associative.
An array is "associative" if it doesn't have sequential numerical keys beginning with zero.
at line line 349
static
array
only(
array $array,
array|string $keys)
Get a subset of the items from the given array.
at line line 362
static
array
pluck(
array $array,
string|array $value,
string|array|null $key = null)
Pluck an array of values from an array.
at line line 410
static
array
prepend(
array $array,
mixed $value,
mixed $key = null)
Push an item onto the beginning of an array.
at line line 429
static
mixed
pull(
array $array,
string $key,
mixed $default = null)
Get a value from the array, and remove it.
at line line 448
static
array
set(
array $array,
string $key,
mixed $value)
Set an array item to a given value using "dot" notation.
If no key is given to the method, the entire array will be replaced.
at line line 481
static
array
sort(
array $array,
callable $callback)
Sort the array using the given callback.
at line line 492
static
array
sortRecursive(
array $array)
Recursively sort an array by keys and values.
at line line 516
static
array
where(
array $array,
callable $callback)
Filter the array using the given callback.