Download the PHP package weew/helpers-array without Composer
On this page you can find all versions of the php package weew/helpers-array. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download weew/helpers-array
More information about weew/helpers-array
Files in weew/helpers-array
Package helpers-array
Short Description Useful collection of php array helpers.
License MIT
Informations about the package helpers-array
Array helpers
Table of contents
- Installation
- Introduction
- Functions
- array_get
- array_has
- array_set
- array_remove
- array_add
- array_take
- array_first
- array_last
- array_reset
- array_dot
- array_extend
- array_extend_distinct
- array_is_associative
- array_is_indexed
- array_contains
Installation
composer require weew/helpers-array
Introduction
This tiny library provides various helper functions to deal with arrays.
Functions
array_get
Get an item from an array using "dot" notation.
mixed array_get(array $array, mixed $key [, mixed $default = null])
array_has
Check if an item exists in an array using "dot" notation.
bool array_has(array $array, mixed $key)
array_set
Set an array item to a given value using "dot" notation.
array array_set(array &$array, mixed $key, mixed $value)
array_remove
Remove one or many array items from a given array using "dot" notation.
void array_remove(array &$array, mixed $keys)
array_add
Add an element to the array at a specific location using the "dot" notation.
array array_add(array &$array, mixed $key, mixed $value)
array_take
Get an element and remove it from the array using the "dot" notation.
array array_take(array &$array, mixed $key, [, mixed $default = null])
array_first
Get the first element from an array.
array array_first(array &$array, [, mixed $default = null])
array_last
Get the last element from an array.
array array_last(array &$array, [, mixed $default = null])
array_reset
Reset all numerical indexes of an array (start from zero). Non-numerical indexes will stay untouched.
array array_reset(array $array [, bool $deep = false])
array_dot
Flatten a multi-dimensional associative array with dots.
array array_dot(array $array [, string $prepend = ''])
array_extend
Extend one array with another.
array array_extend(array $arrays [, array $...])
array_extend_distinct
Extend one array with another. Non associative arrays will not be merged but rather replaced.
array array_extend_distinct(array $arrays [, array $...])
array_is_associative
Check if the given array is associative.
bool array_is_associative(array $array)
array_is_indexed
Check if an array has a numeric index.
bool array_is_indexed(array $array)
array_contains
Check if array contains a specific element.
array array_contains(array $array, mixed $search [, bool $strict = true])