class Illuminate / Support / Arr
You are viewing an older version of the documentation. For the latest, please visit master documentation.

Arr

Uses

Methods

public static

accessible ( $value ) : bool

Determine whether the given value is array accessible.

Parameters

  • $value mixed
public static

add ( $array , $key , $value ) : array

Add an element to an array using "dot" notation if it doesn't exist.

Parameters

  • $array array
  • $key string
  • $value mixed
public static

collapse ( $array ) : array

Collapse an array of arrays into a single array.

Parameters

  • $array iterable
public static

crossJoin ( $arrays ) : array

Cross join the given arrays, returning all possible permutations.

Parameters

  • $arrays iterable
public static

divide ( $array ) : array

Divide an array into two arrays. One with keys and the other with values.

Parameters

  • $array array
public static

dot ( $array , $prepend ) : array

Flatten a multi-dimensional associative array with dots.

Parameters

  • $array iterable
  • $prepend string
public static

undot ( $array ) : array

Convert a flatten "dot" notation array into an expanded array.

Parameters

  • $array iterable
public static

except ( $array , $keys ) : array

Get all of the given array except for a specified array of keys.

Parameters

  • $array array
  • $keys array|string
public static

exists ( $array , $key ) : bool

Determine if the given key exists in the provided array.

Parameters

public static

first ( $array , callable $callback , $default ) : mixed

Return the first element in an array passing a given truth test.

Parameters

  • $array iterable
  • $callback callable|null
  • $default mixed
public static

last ( $array , callable $callback , $default ) : mixed

Return the last element in an array passing a given truth test.

Parameters

  • $array array
  • $callback callable|null
  • $default mixed
public static

flatten ( $array , $depth ) : array

Flatten a multi-dimensional array into a single level.

Parameters

  • $array iterable
  • $depth int
public static

forget ( $array , $keys ) : void

Remove one or many array items from a given array using "dot" notation.

Parameters

  • $array array
  • $keys array|string
public static

get ( $array , $key , $default ) : mixed

Get an item from an array using "dot" notation.

Parameters

  • $array ArrayAccess |array
  • $key string|int|null
  • $default mixed
public static

has ( $array , $keys ) : bool

Check if an item or items exist in an array using "dot" notation.

Parameters

public static

hasAny ( $array , $keys ) : bool

Determine if any of the keys exist in an array using "dot" notation.

Parameters

public static

isAssoc ( array $array ) : bool

Determines if an array is associative.

Parameters

  • $array array
public static

isList ( $array ) : bool

Determines if an array is a list.

Parameters

  • $array array
public static

only ( $array , $keys ) : array

Get a subset of the items from the given array.

Parameters

  • $array array
  • $keys array|string
public static

pluck ( $array , $value , $key ) : array

Pluck an array of values from an array.

Parameters

  • $array iterable
  • $value string|array|int|null
  • $key string|array|null
protected static

explodePluckParameters ( $value , $key ) : array

Explode the "value" and "key" arguments passed to "pluck".

Parameters

  • $value string|array
  • $key string|array|null
public static

prepend ( $array , $value , $key ) : array

Push an item onto the beginning of an array.

Parameters

  • $array array
  • $value mixed
  • $key mixed
public static

pull ( $array , $key , $default ) : mixed

Get a value from the array, and remove it.

Parameters

  • $array array
  • $key string|int
  • $default mixed
public static

query ( $array ) : string

Convert the array into a query string.

Parameters

  • $array array
public static

random ( $array , $number , $preserveKeys ) : mixed

Get one or a specified number of random values from an array.

Parameters

  • $array array
  • $number int|null
  • $preserveKeys bool|false
public static

set ( $array , $key , $value ) : array

Set an array item to a given value using "dot" notation.

Parameters

  • $array array
  • $key string|null
  • $value mixed
public static

shuffle ( $array , $seed ) : array

Shuffle the given array and return the result.

Parameters

  • $array array
  • $seed int|null
public static

sort ( $array , $callback ) : array

Sort the array using the given callback or "dot" notation.

Parameters

  • $array array
  • $callback callable|array|string|null
public static

sortRecursive ( $array , $options , $descending ) : array

Recursively sort an array by keys and values.

Parameters

  • $array array
  • $options int
  • $descending bool
public static

toCssClasses ( $array ) : string

Conditionally compile classes from an array into a CSS class list.

Parameters

  • $array array
public static

where ( $array , callable $callback ) : array

Filter the array using the given callback.

Parameters

  • $array array
  • $callback callable
public static

whereNotNull ( $array ) : array

Filter items where the value is not null.

Parameters

  • $array array
public static

wrap ( $value ) : array

If the given value is not an array and not null, wrap it in one.

Parameters

  • $value mixed