Download the PHP package voku/arrayy without Composer
On this page you can find all versions of the php package voku/arrayy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package arrayy
π Arrayy
A PHP array manipulation library. Compatible with PHP 7+ & PHP 8+
- Installation
- Multidimensional ArrayAccess
- PhpDoc @property checking
- OO and Chaining
- Collections
- Pre-Defined Typified Collections
- Convert JSON-Data into Collections
- Class methods
- use a "default object"
- create
- createByReference
- createFromJson
- createFromJsonMapper
- createFromObject
- createFromObjectVars
- createWithRange
- createFromGeneratorImmutable
- createFromGeneratorFunction
- createFromString
- Instance methods
- "set an array value"
- "set an array value via dot-notation"
- "get an array value"
- "get an array value via dot-notation"
- "get the array"
- "delete an array value"
- "check if an array value is-set"
- "simple loop with an Arrayy-object"
- overview
- Tests
- License
Installation via "composer require"
Multidimensional ArrayAccess
You can access / change the array via Object, Array or with "Arrayy"-syntax.
Access via "Arrayy"-syntax: (dot-notation)
Access via "array"-syntax:
Access via "object"-syntax:
Set values via "Arrayy"-syntax: (dot-notation)
Set values via "array"-syntax:
Set values via "object"-syntax:
PhpDoc @property checking
The library offers a type checking for @property phpdoc-class-comments, as seen below:
- "checkPropertyTypes": activate the type checking for all defined @property in the class-phpdoc
- "checkPropertiesMismatchInConstructor": activate the property mismatch check, so you can only add an array with all needed properties (or an empty array) into the constructor
OO and Chaining
The library also offers OO method chaining, as seen below:
simple example:
complex example:
Implemented Interfaces
Arrayy\Arrayy
implements the IteratorAggregate
interface, meaning that
foreach
can be used with an instance of the class:
It implements the Countable
interface, enabling the use of count()
to
retrieve the number of elements in the array:
PHP 5.6 Creation
As of PHP 5.6, use function
is
available for importing functions. Arrayy exposes a namespaced function,
Arrayy\create
, which emits the same behaviour as Arrayy\Arrayy::create()
.
If running PHP 5.6, or another runtime that supports the use function
syntax,
you can take advantage of an even simpler API as seen below:
Collections
If you need to group objects together, it's not a good idea to use a simple array or Arrayy object. For these cases you can use the class.
It will throw a if you try to add a non valid object into the collection.
e.g.: "YOURCollection.php" (see example on github)
You can also use "dot-notation" to get data from your collections e.g.
Pre-Defined Typified Collections
simple example
This will throw a "TypeError"-Exception.
complex example
This will NOT throw a "TypeError"-Exception.
Convert JSON-Data into Objects (Collection)
Class methods
use a "default object"
Creates an Arrayy object.
create(array $array) : Arrayy (Immutable)
Creates an Arrayy object, via static "create()"-method
createByReference(array &$array) : Arrayy (Mutable)
WARNING: Creates an Arrayy object by reference.
createFromJson(string $json) : Arrayy (Immutable)
Create an new Arrayy object via JSON.
createFromJsonMapper(string $json) : Arrayy (Immutable)
Create an new Arrayy object via JSON and fill sub-objects is possible.
createFromObject(ArrayAccess $object) : Arrayy (Immutable)
Create an new instance filled with values from an object that have implemented ArrayAccess.
createFromObjectVars(\object $object) : Arrayy (Immutable)
Create an new instance filled with values from an object.
createWithRange() : Arrayy (Immutable)
Create an new instance containing a range of elements.
createFromGeneratorImmutable() : Arrayy (Immutable)
Create an new instance filled with a copy of values from a "Generator"-object.
WARNING: Need more memory then the "A::createFromGeneratorFunction()" call, because we will fetch and store all keys and values from the Generator.
createFromGeneratorFunction() : Arrayy (Immutable)
Create an new instance from a callable function which will return a Generator.
createFromString(string $str) : Arrayy (Immutable)
Create an new Arrayy object via string.
Instance Methods
Arrayy: All examples below make use of PHP 5.6 function importing, and PHP 5.4 short array syntax. For further details, see the documentation for the create method above, as well as the notes on PHP 5.6 creation.
"set an array value"
"get an array value"
"get the array"
"delete an array value"
"check if an array value is-set"
"simple loop with an Arrayy-object"
Arrayy methods
add | append | appendArrayValues | appendImmutable |
appendToEachKey | appendToEachValue | arsort | arsortImmutable |
asort | asortImmutable | at | average |
changeKeyCase | changeSeparator | chunk | clean |
clear | contains | containsCaseInsensitive | containsKey |
containsKeys | containsKeysRecursive | containsOnly | containsValue |
containsValueRecursive | containsValues | count | countValues |
create | createByReference | createFromArray | createFromGeneratorFunction |
createFromGeneratorImmutable | createFromJson | createFromJsonMapper | createFromObject |
createFromObjectVars | createFromString | createFromTraversableImmutable | createWithRange |
current | customSortKeys | customSortKeysImmutable | customSortValues |
customSortValuesImmutable | delete | diff | diffKey |
diffKeyAndValue | diffRecursive | diffReverse | divide |
each | end | exchangeArray | exists |
fillWithDefaults | filter | filterBy | find |
findBy | first | firstKey | firstsImmutable |
firstsKeys | firstsMutable | flatten | flip |
get | getAll | getArray | getArrayCopy |
getBackwardsGenerator | getColumn | getFlags | getGenerator |
getGeneratorByReference | getIterator | getIteratorClass | getKeys |
getList | getObject | getPhpDocPropertiesFromClass | getRandom |
getRandomKey | getRandomKeys | getRandomValue | getRandomValues |
getValues | getValuesYield | group | has |
hasValue | implode | implodeKeys | indexBy |
indexOf | initial | intersection | intersectionMulti |
intersects | invoke | isAssoc | isEmpty |
isEqual | isMultiArray | isNumeric | isSequential |
jsonSerialize | key | keyExists | keys |
krsort | krsortImmutable | ksort | ksortImmutable |
last | lastKey | lastsImmutable | lastsMutable |
length | map | matches | matchesAny |
max | mergeAppendKeepIndex | mergeAppendNewIndex | mergePrependKeepIndex |
mergePrependNewIndex | meta | min | mostUsedValue |
mostUsedValues | moveElement | moveElementToFirstPlace | moveElementToLastPlace |
natcasesort | natcasesortImmutable | natsort | natsortImmutable |
next | nth | offsetExists | offsetGet |
offsetSet | offsetUnset | only | pad |
partition | pop | prepend | prependImmutable |
prependToEachKey | prependToEachValue | pull | push |
randomImmutable | randomKey | randomKeys | randomMutable |
randomValue | randomValues | randomWeighted | reduce |
reduce_dimension | reindex | reject | remove |
removeElement | removeFirst | removeLast | removeValue |
repeat | replace | replaceAllKeys | replaceAllValues |
replaceKeys | replaceOneValue | replaceValues | rest |
reverse | reverseKeepIndex | rsort | rsortImmutable |
searchIndex | searchValue | serialize | set |
setAndGet | setFlags | setIteratorClass | shift |
shuffle | size | sizeIs | sizeIsBetween |
sizeIsGreaterThan | sizeIsLessThan | sizeRecursive | slice |
sort | sortImmutable | sortKeys | sortKeysImmutable |
sortValueKeepIndex | sortValueNewIndex | sorter | splice |
split | stripEmpty | swap | toArray |
toJson | toList | toPermutation | toString |
uasort | uasortImmutable | uksort | uksortImmutable |
unique | uniqueKeepIndex | uniqueNewIndex | unserialize |
unshift | validate | values | walk |
where |
(Immutable) Return this Arrayy object, with the appended values.
` -------- ## append(mixed $value, mixed $key): $this β Append a (key) + value to the current array. EXAMPLE:
a(['fΓ²Γ΄' => 'bΓ Ε'])->append('foo'); // Arrayy['fΓ²Γ΄' => 'bΓ Ε', 0 => 'foo']
**Parameters:**
- `T $value`
- `TKey|null $key`
**Return:**
- `$this (Mutable) Return this Arrayy object, with the appended values.
` -------- ## appendArrayValues(array $values, mixed $key): $this β Append a (key) + values to the current array. EXAMPLE:
a(['fΓ²Γ΄' => ['bΓ Ε']])->appendArrayValues(['foo1', 'foo2'], 'fΓ²Γ΄'); // Arrayy['fΓ²Γ΄' => ['bΓ Ε', 'foo1', 'foo2']]
**Parameters:**
- `array(Mutable) Return this Arrayy object, with the appended values.
` -------- ## appendImmutable(mixed $value, mixed $key): $this β Append a (key) + value to the current array. EXAMPLE:
a(['fΓ²Γ΄' => 'bΓ Ε'])->appendImmutable('foo')->getArray(); // ['fΓ²Γ΄' => 'bΓ Ε', 0 => 'foo']
**Parameters:**
- `T $value`
- `TKey $key`
**Return:**
- `$this (Immutable) Return this Arrayy object, with the appended values.
` -------- ## appendToEachKey(int|string $prefix): static β Add a suffix to each key. **Parameters:** - `int|string $prefix` **Return:** - `static(Immutable) Return an Arrayy object, with the prefixed keys.
` -------- ## appendToEachValue(float|int|string $prefix): static β Add a prefix to each value. **Parameters:** - `float|int|string $prefix` **Return:** - `static(Immutable) Return an Arrayy object, with the prefixed values.
` -------- ## arsort(): $this β Sort an array in reverse order and maintain index association. **Parameters:** __nothing__ **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## arsortImmutable(): $this β Sort an array in reverse order and maintain index association. **Parameters:** __nothing__ **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## asort(int $sort_flags): $this β Sort the entries by value. **Parameters:** - `int $sort_flags [optional]You may modify the behavior of the sort using the optional parameter sort_flags, for details see sort.
` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## asortImmutable(int $sort_flags): $this β Sort the entries by value. **Parameters:** - `int $sort_flags [optional]You may modify the behavior of the sort using the optional parameter sort_flags, for details see sort.
` **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## at(\Closure $closure): static β Iterate over the current array and execute a callback for each loop. EXAMPLE:
$result = A::create();
$closure = function ($value, $key) use ($result) {
$result[$key] = ':' . $value . ':';
};
a(['foo', 'bar' => 'bis'])->at($closure); // Arrayy[':foo:', 'bar' => ':bis:']
**Parameters:**
- `\Closure(T , TKey ): mixed $closure`
**Return:**
- `static (Immutable)
` -------- ## average(int $decimals): float|int β Returns the average value of the current array. EXAMPLE:
a([-9, -8, -7, 1.32])->average(2); // -5.67
**Parameters:**
- `int $decimals The number of decimal-numbers to return.
` **Return:** - `float|intThe average value.
` -------- ## changeKeyCase(int $case): static β Changes all keys in an array. **Parameters:** - `int $case [optional] Either CASE_UPPER
or CASE_LOWER (default)
(Immutable)
` -------- ## changeSeparator(string $separator): $this β Change the path separator of the array wrapper. By default, the separator is: "." **Parameters:** - `non-empty-string $separatorSeparator to set.
` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## chunk(int $size, bool $preserveKeys): static|static[] β Create a chunked version of the current array. EXAMPLE:
a([-9, -8, -7, 1.32])->chunk(2); // Arrayy[[-9, -8], [-7, 1.32]]
**Parameters:**
- `int $size Size of each chunk.
` - `bool $preserveKeysWhether array keys are preserved or no.
` **Return:** - `static|static[](Immutable) A new array of chunks from the original array.
` -------- ## clean(): static β Clean all falsy values from the current array. EXAMPLE:
a([-8 => -9, 1, 2 => false])->clean(); // Arrayy[-8 => -9, 1]
**Parameters:**
__nothing__
**Return:**
- `static (Immutable)
` -------- ## clear(int|int[]|string|string[]|null $key): $this β WARNING!!! -> Clear the current full array or a $key of it. EXAMPLE:
a([-8 => -9, 1, 2 => false])->clear(); // Arrayy[]
**Parameters:**
- `int|int[]|string|string[]|null $key`
**Return:**
- `$this (Mutable) Return this Arrayy object, with an empty array.
` -------- ## contains(float|int|string $value, bool $recursive, bool $strict): bool β Check if an item is in the current array. EXAMPLE:
a([1, true])->contains(true); // true
**Parameters:**
- `float|int|string $value`
- `bool $recursive`
- `bool $strict`
**Return:**
- `bool`
--------
## containsCaseInsensitive(mixed $value, bool $recursive): bool
β
Check if an (case-insensitive) string is in the current array.
EXAMPLE:
a(['E', 'Γ©'])->containsCaseInsensitive('Γ'); // true
**Parameters:**
- `mixed $value`
- `bool $recursive`
**Return:**
- `bool`
--------
## containsKey(int|string $key): bool
β
Check if the given key/index exists in the array.
EXAMPLE:
a([1 => true])->containsKey(1); // true
**Parameters:**
- `int|string $key key/index to search for
` **Return:** - `boolReturns true if the given key/index exists in the array, false otherwise.
` -------- ## containsKeys(array $needles, bool $recursive): bool β Check if all given needles are present in the array as key/index. EXAMPLE:
a([1 => true])->containsKeys(array(1 => 0)); // true
**Parameters:**
- `arrayThe keys you are searching for.
` - `bool $recursive` **Return:** - `boolReturns true if all the given keys/indexes exists in the array, false otherwise.
` -------- ## containsKeysRecursive(array $needles): bool β Check if all given needles are present in the array as key/index. **Parameters:** - `arrayThe keys you are searching for.
` **Return:** - `boolReturns true if all the given keys/indexes exists in the array, false otherwise.
` -------- ## containsOnly(float|int|string $value, bool $recursive, bool $strict): bool β Check if an item is in the current array. EXAMPLE:
a([1, true])->containsOnly(true); // false
**Parameters:**
- `float|int|string $value`
- `bool $recursive`
- `bool $strict`
**Return:**
- `bool`
--------
## containsValue(float|int|string $value): bool
β
alias: for "Arrayy->contains()"
**Parameters:**
- `float|int|string $value`
**Return:**
- `bool`
--------
## containsValueRecursive(float|int|string $value): bool
β
alias: for "Arrayy->contains($value, true)"
**Parameters:**
- `float|int|string $value`
**Return:**
- `bool`
--------
## containsValues(array $needles): bool
β
Check if all given needles are present in the array.
EXAMPLE:
a([1, true])->containsValues(array(1, true)); // true
**Parameters:**
- `arrayReturns true if all the given values exists in the array, false otherwise.
` -------- ## count(int $mode): int β Counts all elements in an array, or something in an object. EXAMPLE:
a([-9, -8, -7, 1.32])->count(); // 4
For objects, if you have SPL installed, you can hook into count() by implementing interface {@see \Countable}. The interface has exactly one method, {@see \Countable::count()}, which returns the return value for the count() function. Please see the {@see \Array} section of the manual for a detailed explanation of how arrays are implemented and used in PHP.
**Parameters:** - `int $mode [optional] If the optional mode parameter is set to COUNT_RECURSIVE (or 1), count will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array. count does not detect infinite recursion.` **Return:** - `intThe number of elements in var, which is typically an array, since anything else will have one element.
If var is not an array or an object with implemented Countable interface, 1 will be returned. There is one exception, if var is &null;, 0 will be returned.
Caution: count may return 0 for a variable that isn't set, but it may also return 0 for a variable that has been initialized with an empty array. Use isset to test if a variable is set.
` -------- ## countValues(): static β Counts all the values of an array **Parameters:** __nothing__ **Return:** - `static(Immutable) An associative Arrayy-object of values from input as keys and their count as value.
` -------- ## create(mixed $data, string $iteratorClass, bool $checkPropertiesInConstructor): static β Creates an Arrayy object. **Parameters:** - `mixed $data` - `class-string<\Arrayy\ArrayyIterator> $iteratorClass` - `bool $checkPropertiesInConstructor` **Return:** - `static(Immutable) Returns an new instance of the Arrayy object.
` -------- ## createByReference(array $array): $this β WARNING: Creates an Arrayy object by reference. **Parameters:** - `array $array` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## createFromArray(array $array): static β Create an new Arrayy object via JSON. **Parameters:** - `array $array` **Return:** - `static(Immutable) Returns an new instance of the Arrayy object.
` -------- ## createFromGeneratorFunction(callable $generatorFunction): static β Create an new instance from a callable function which will return an Generator. **Parameters:** - `callable(): \Generator(Immutable) Returns an new instance of the Arrayy object.
` -------- ## createFromGeneratorImmutable(\Generator $generator): static β Create an new instance filled with a copy of values from a "Generator"-object. **Parameters:** - `\Generator(Immutable) Returns an new instance of the Arrayy object.
` -------- ## createFromJson(string $json): static β Create an new Arrayy object via JSON. **Parameters:** - `string $json` **Return:** - `static(Immutable) Returns an new instance of the Arrayy object.
` -------- ## createFromJsonMapper(string $json): static β **Parameters:** - `string $json` **Return:** - `static(Immutable)
` -------- ## createFromObject(\Traversable $object): static β Create an new instance filled with values from an object that is iterable. **Parameters:** - `\Traversableiterable object
` **Return:** - `static(Immutable) Returns an new instance of the Arrayy object.
` -------- ## createFromObjectVars(object $object): static β Create an new instance filled with values from an object. **Parameters:** - `object $object` **Return:** - `static(Immutable) Returns an new instance of the Arrayy object.
` -------- ## createFromString(string $str, string|null $delimiter, string|null $regEx): static β Create an new Arrayy object via string. **Parameters:** - `string $strThe input string.
` - `non-empty-string|null $delimiterThe boundary string.
` - `string|null $regExUse the $delimiter or the $regEx, so if $pattern is null, $delimiter will be used.
` **Return:** - `static(Immutable) Returns an new instance of the Arrayy object.
` -------- ## createFromTraversableImmutable(\Traversable $traversable, bool $use_keys): static β Create an new instance filled with a copy of values from a "Traversable"-object. **Parameters:** - `\Traversable<(array-key|TKey), T> $traversable` - `bool $use_keys [optional]Whether to use the iterator element keys as index.
` **Return:** - `static(Immutable) Returns an new instance of the Arrayy object.
` -------- ## createWithRange(float|int|string $low, float|int|string $high, float|int $step): static β Create an new instance containing a range of elements. **Parameters:** - `float|int|string $lowFirst value of the sequence.
` - `float|int|string $highThe sequence is ended upon reaching the end value.
` - `float|int $stepUsed as the increment between elements in the sequence.
` **Return:** - `static(Immutable) Returns an new instance of the Arrayy object.
` -------- ## current(): false|mixed β Gets the element of the array at the current internal iterator position. **Parameters:** __nothing__ **Return:** - `false|mixed` -------- ## customSortKeys(callable $callable): $this β Custom sort by index via "uksort". EXAMPLE:
$callable = function ($a, $b) {
if ($a == $b) {
return 0;
}
return ($a > $b) ? 1 : -1;
};
$arrayy = a(['three' => 3, 'one' => 1, 'two' => 2]);
$resultArrayy = $arrayy->customSortKeys($callable); // Arrayy['one' => 1, 'three' => 3, 'two' => 2]
**Parameters:**
- `callable $callable`
**Return:**
- `$this (Mutable) Return this Arrayy object.
` -------- ## customSortKeysImmutable(callable $callable): $this β Custom sort by index via "uksort". **Parameters:** - `callable $callable` **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## customSortValues(callable $callable): $this β Custom sort by value via "usort". EXAMPLE:
$callable = function ($a, $b) {
if ($a == $b) {
return 0;
}
return ($a > $b) ? 1 : -1;
};
$arrayy = a(['three' => 3, 'one' => 1, 'two' => 2]);
$resultArrayy = $arrayy->customSortValues($callable); // Arrayy[1, 2, 3]
**Parameters:**
- `callable $callable`
**Return:**
- `$this (Mutable) Return this Arrayy object.
` -------- ## customSortValuesImmutable(callable $callable): $this β Custom sort by value via "usort". **Parameters:** - `callable $callable` **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## delete(int|int[]|string|string[] $keyOrKeys): void β Delete the given key or keys. **Parameters:** - `int|int[]|string|string[] $keyOrKeys` **Return:** - `void` -------- ## diff(array $array): static β Return elements where the values that are only in the current array. EXAMPLE:
a([1 => 1, 2 => 2])->diff([1 => 1]); // Arrayy[2 => 2]
**Parameters:**
- `array ...$array`
**Return:**
- `static (Immutable)
` -------- ## diffKey(array $array): static β Return elements where the keys are only in the current array. **Parameters:** - `array ...$array` **Return:** - `static(Immutable)
` -------- ## diffKeyAndValue(array $array): static β Return elements where the values and keys are only in the current array. **Parameters:** - `array ...$array` **Return:** - `static(Immutable)
` -------- ## diffRecursive(array $array, array|\Generator|null $helperVariableForRecursion): static β Return elements where the values are only in the current multi-dimensional array. EXAMPLE:
a([1 => [1 => 1], 2 => [2 => 2]])->diffRecursive([1 => [1 => 1]]); // Arrayy[2 => [2 => 2]]
**Parameters:**
- `array $array`
- `null|array(only for internal usage)
` **Return:** - `static(Immutable)
` -------- ## diffReverse(array $array): static β Return elements where the values that are only in the new $array. EXAMPLE:
a([1 => 1])->diffReverse([1 => 1, 2 => 2]); // Arrayy[2 => 2]
**Parameters:**
- `array $array`
**Return:**
- `static (Immutable)
` -------- ## divide(): static β Divide an array into two arrays. One with keys and the other with values. EXAMPLE:
a(['a' => 1, 'b' => ''])->divide(); // Arrayy[Arrayy['a', 'b'], Arrayy[1, '']]
**Parameters:**
__nothing__
**Return:**
- `static (Immutable)
` -------- ## each(\Closure $closure): static β Iterate over the current array and modify the array's value. EXAMPLE:
$result = A::create();
$closure = function ($value) {
return ':' . $value . ':';
};
a(['foo', 'bar' => 'bis'])->each($closure); // Arrayy[':foo:', 'bar' => ':bis:']
**Parameters:**
- `\Closure(T , ?TKey ): T $closure`
**Return:**
- `static (Immutable)
` -------- ## end(): false|mixed β Sets the internal iterator to the last element in the array and returns this element. **Parameters:** __nothing__ **Return:** - `false|mixed` -------- ## exchangeArray(array|mixed|static $data): array β Exchange the array for another one. **Parameters:** - `T|array
$callable = function ($value, $key) {
return 2 === $key and 'two' === $value;
};
a(['foo', 2 => 'two'])->exists($callable); // true
**Parameters:**
- `\Closure(T , TKey ): bool $closure`
**Return:**
- `bool Returns true if the given value is found, false otherwise.
` -------- ## fillWithDefaults(int $num, mixed $default): static β Fill the array until "$num" with "$default" values. EXAMPLE:
a(['bar'])->fillWithDefaults(3, 'foo'); // Arrayy['bar', 'foo', 'foo']
**Parameters:**
- `int $num`
- `T $default`
**Return:**
- `static (Immutable)
` -------- ## filter(\Closure|null $closure, int $flag): static β Find all items in an array that pass the truth test. EXAMPLE:
$closure = function ($value) {
return $value % 2 !== 0;
}
a([1, 2, 3, 4])->filter($closure); // Arrayy[0 => 1, 2 => 3]
**Parameters:**
- `null|\Closure(T , TKey = default): bool|\Closure(T ): bool|\Closure(TKey ): bool $closure [optional] The callback function to use
If no callback is supplied, all entries of input equal to false (see converting to boolean) will be removed.
` - `int $flag [optional]Flag determining what arguments are sent to callback:
- ARRAY_FILTER_USE_KEY (1) - pass key as the only argument to callback instead of the value
- ARRAY_FILTER_USE_BOTH (2) - pass both value and key as arguments to callback instead of the value
(Immutable)
` -------- ## filterBy(string $property, mixed $value, string|null $comparisonOp): static β Filters an array of objects (or a numeric array of associative arrays) based on the value of a particular property within that. **Parameters:** - `string $property` - `array|T $value` - `string|null $comparisonOp
'eq' (equals),
'gt' (greater),
'gte' || 'ge' (greater or equals),
'lt' (less),
'lte' || 'le' (less or equals),
'ne' (not equals),
'contains',
'notContains',
'newer' (via strtotime),
'older' (via strtotime),
(Immutable)
` -------- ## find(\Closure $closure): false|mixed β Find the first item in an array that passes the truth test, otherwise return false. EXAMPLE:
$search = 'foo';
$closure = function ($value, $key) use ($search) {
return $value === $search;
};
a(['foo', 'bar', 'lall'])->find($closure); // 'foo'
**Parameters:**
- `\Closure(T , TKey ): bool $closure`
**Return:**
- `false|mixed Return false if we did not find the value.
` -------- ## findBy(string $property, mixed $value, string $comparisonOp): static β find by ... EXAMPLE:
$array = [
0 => ['id' => 123, 'name' => 'foo', 'group' => 'primary', 'value' => 123456, 'when' => '2014-01-01'],
1 => ['id' => 456, 'name' => 'bar', 'group' => 'primary', 'value' => 1468, 'when' => '2014-07-15'],
];
a($array)->filterBy('name', 'foo'); // Arrayy[0 => ['id' => 123, 'name' => 'foo', 'group' => 'primary', 'value' => 123456, 'when' => '2014-01-01']]
**Parameters:**
- `string $property`
- `array|T $value`
- `string $comparisonOp`
**Return:**
- `static (Immutable)
` -------- ## first(): mixed|null β Get the first value from the current array. EXAMPLE:
a([2 => 'foo', 3 => 'bar', 4 => 'lall'])->first(); // 'foo'
**Parameters:**
__nothing__
**Return:**
- `mixed|null Return null if there wasn't a element.
` -------- ## firstKey(): mixed|null β Get the first key from the current array. **Parameters:** __nothing__ **Return:** - `mixed|nullReturn null if there wasn't a element.
` -------- ## firstsImmutable(int|null $number): static β Get the first value(s) from the current array. And will return an empty array if there was no first entry. EXAMPLE:
a([2 => 'foo', 3 => 'bar', 4 => 'lall'])->firstsImmutable(2); // Arrayy[0 => 'foo', 1 => 'bar']
**Parameters:**
- `int|null $number How many values you will take?
` **Return:** - `static(Immutable)
` -------- ## firstsKeys(int|null $number): static β Get the first value(s) from the current array. And will return an empty array if there was no first entry. **Parameters:** - `int|null $numberHow many values you will take?
` **Return:** - `static(Immutable)
` -------- ## firstsMutable(int|null $number): $this β Get and remove the first value(s) from the current array. And will return an empty array if there was no first entry. EXAMPLE:
a([2 => 'foo', 3 => 'bar', 4 => 'lall'])->firstsMutable(); // 'foo'
**Parameters:**
- `int|null $number How many values you will take?
` **Return:** - `$this(Mutable)
` -------- ## flatten(string $delimiter, string $prepend, array|null $items): array β Flatten an array with the given character as a key delimiter. EXAMPLE:
$dot = a(['foo' => ['abc' => 'xyz', 'bar' => ['baz']]]);
$flatten = $dot->flatten();
$flatten['foo.abc']; // 'xyz'
$flatten['foo.bar.0']; // 'baz'
**Parameters:**
- `string $delimiter`
- `string $prepend`
- `array|null $items`
**Return:**
- `array`
--------
## flip(): static
β
Exchanges all keys with their associated values in an array.
EXAMPLE:
a([0 => 'foo', 1 => 'bar'])->flip(); // Arrayy['foo' => 0, 'bar' => 1]
**Parameters:**
__nothing__
**Return:**
- `static (Immutable)
` -------- ## get(int|string $key, mixed $fallback, array|null $array, bool $useByReference): mixed|static β Get a value from an array (optional using dot-notation). EXAMPLE:
$arrayy = a(['user' => ['lastname' => 'Moelleken']]);
$arrayy->get('user.lastname'); // 'Moelleken'
// ---
$arrayy = new A();
$arrayy['user'] = ['lastname' => 'Moelleken'];
$arrayy['user.firstname'] = 'Lars';
$arrayy['user']['lastname']; // Moelleken
$arrayy['user.lastname']; // Moelleken
$arrayy['user.firstname']; // Lars
**Parameters:**
- `TKey $key The key to look for.
` - `mixed $fallbackValue to fallback to.
` - `array|null $arrayThe array to get from, if it's set to "null" we use the current array from the class.
` - `bool $useByReference` **Return:** - `mixed|static` -------- ## getAll(): array β alias: for "Arrayy->toArray()" **Parameters:** __nothing__ **Return:** - `array` -------- ## getArray(bool $convertAllArrayyElements, bool $preserveKeys): array β Get the current array from the "Arrayy"-object. alias for "toArray()" **Parameters:** - `bool $convertAllArrayyElementsConvert all Child-"Arrayy" objects also to arrays.
` - `bool $preserveKeyse.g.: A generator maybe return the same key more than once, so maybe you will ignore the keys.
` **Return:** - `array` -------- ## getArrayCopy(): array β Creates a copy of the ArrayyObject. **Parameters:** __nothing__ **Return:** - `array` -------- ## getBackwardsGenerator(): Generator β Get the current array from the "Arrayy"-object as generator. **Parameters:** __nothing__ **Return:** - `\Generator` -------- ## getColumn(int|string|null $columnKey, int|string|null $indexKey): static β Returns the values from a single column of the input array, identified by the $columnKey, can be used to extract data-columns from multi-arrays. EXAMPLE:
a([['foo' => 'bar', 'id' => 1], ['foo => 'lall', 'id' => 2]])->getColumn('foo', 'id'); // Arrayy[1 => 'bar', 2 => 'lall']
INFO: Optionally, you may provide an $indexKey to index the values in the returned
array by the values from the $indexKey column in the input array.
**Parameters:**
- `int|string|null $columnKey`
- `int|string|null $indexKey`
**Return:**
- `static (Immutable)
` -------- ## getFlags(): β **Parameters:** __nothing__ **Return:** - `TODO: __not_detected__` -------- ## getGenerator(): Generator β Get the current array from the "Arrayy"-object as generator. **Parameters:** __nothing__ **Return:** - `\Generator` -------- ## getGeneratorByReference(): Generator β Get the current array from the "Arrayy"-object as generator by reference. **Parameters:** __nothing__ **Return:** - `\Generator` -------- ## getIterator(): Iterator
a(['foo', 'bar'])->getIterator(); // ArrayyIterator['foo', 'bar']
**Parameters:**
__nothing__
**Return:**
- `\IteratorAn iterator for the values in the array.
` -------- ## getIteratorClass(): string β Gets the iterator classname for the ArrayObject. **Parameters:** __nothing__ **Return:** - `string` -------- ## getKeys(): static β alias: for "Arrayy->keys()" **Parameters:** __nothing__ **Return:** - `static(Immutable)
` -------- ## getList(bool $convertAllArrayyElements): array β Get the current array from the "Arrayy"-object as list. alias for "toList()" **Parameters:** - `bool $convertAllArrayyElementsConvert all Child-"Arrayy" objects also to arrays.
` **Return:** - `array` -------- ## getObject(): stdClass β Get the current array from the "Arrayy"-object as object. **Parameters:** __nothing__ **Return:** - `\stdClass` -------- ## getPhpDocPropertiesFromClass(): array(Immutable)
` -------- ## getRandomKey(): mixed|null β alias: for "Arrayy->randomKey()" **Parameters:** __nothing__ **Return:** - `mixed|nullGet a key/index or null if there wasn't a key/index.
` -------- ## getRandomKeys(int $number): static β alias: for "Arrayy->randomKeys()" **Parameters:** - `int $number` **Return:** - `static(Immutable)
` -------- ## getRandomValue(): mixed|null β alias: for "Arrayy->randomValue()" **Parameters:** __nothing__ **Return:** - `mixed|nullGet a random value or null if there wasn't a value.
` -------- ## getRandomValues(int $number): static β alias: for "Arrayy->randomValues()" **Parameters:** - `int $number` **Return:** - `static(Immutable)
` -------- ## getValues(): static β Gets all values. **Parameters:** __nothing__ **Return:** - `staticThe values of all elements in this array, in the order they appear in the array.
` -------- ## getValuesYield(): Generator β Gets all values via Generator. **Parameters:** __nothing__ **Return:** - `\GeneratorThe values of all elements in this array, in the order they appear in the array as Generator.
` -------- ## group(callable|int|string $grouper, bool $saveKeys): static β Group values from a array according to the results of a closure. **Parameters:** - `\Closure(T , TKey ): TKey|TKey $grouperA callable function name.
` - `bool $saveKeys` **Return:** - `static(Immutable)
` -------- ## has(mixed $key): bool β Check if an array has a given key. **Parameters:** - `null|TKey|TKey[] $key` **Return:** - `bool` -------- ## hasValue(mixed $value): bool β Check if an array has a given value. INFO: If you need to search recursive please use . **Parameters:** - `T $value` **Return:** - `bool` -------- ## implode(string $glue, string $prefix): string β Implodes the values of this array. EXAMPLE:
a([0 => -9, 1, 2])->implode('|'); // '-9|1|2'
**Parameters:**
- `string $glue`
- `string $prefix`
**Return:**
- `string`
--------
## implodeKeys(string $glue): string
β
Implodes the keys of this array.
**Parameters:**
- `string $glue`
**Return:**
- `string`
--------
## indexBy(int|string $key): static
β
Given a list and an iterate-function that returns
a key for each element in the list (or a property name),
returns an object with an index of each item.
**Parameters:**
- `array- $key`
**Return:**
- `static (Immutable)
` -------- ## indexOf(mixed $value): false|int|string β alias: for "Arrayy->searchIndex()" **Parameters:** - `T $valueThe value to search for.
` **Return:** - `false|int|string` -------- ## initial(int $to): static β Get everything but the last..$to items. EXAMPLE:
a([2 => 'foo', 3 => 'bar', 4 => 'lall'])->initial(2); // Arrayy[0 => 'foo']
**Parameters:**
- `int $to`
**Return:**
- `static (Immutable)
` -------- ## intersection(array $search, bool $keepKeys): static β Return an array with all elements found in input array. EXAMPLE:
a(['foo', 'bar'])->intersection(['bar', 'baz']); // Arrayy['bar']
**Parameters:**
- `array(Immutable)
` -------- ## intersectionMulti(array $array): static β Return an array with all elements found in input array. **Parameters:** - `array ...$array` **Return:** - `static(Immutable)
` -------- ## intersects(array $search): bool β Return a boolean flag which indicates whether the two input arrays have any common elements. EXAMPLE:
a(['foo', 'bar'])->intersects(['fΓΆΓΆ', 'bΓ€r']); // false
**Parameters:**
- `array(Immutable)
` -------- ## isAssoc(bool $recursive): bool β Check whether array is associative or not. EXAMPLE:
a(['foo' => 'bar', 2, 3])->isAssoc(); // true
**Parameters:**
- `bool $recursive`
**Return:**
- `bool Returns true if associative, false otherwise.
` -------- ## isEmpty(int|int[]|string|string[]|null $keys): bool β Check if a given key or keys are empty. **Parameters:** - `int|int[]|string|string[]|null $keys` **Return:** - `boolReturns true if empty, false otherwise.
` -------- ## isEqual(array $array): bool β Check if the current array is equal to the given "$array" or not. EXAMPLE:
a(['π©'])->isEqual(['π©']); // true
**Parameters:**
- `array $array`
**Return:**
- `bool`
--------
## isMultiArray(): bool
β
Check if the current array is a multi-array.
EXAMPLE:
a(['foo' => [1, 2 , 3]])->isMultiArray(); // true
**Parameters:**
__nothing__
**Return:**
- `bool`
--------
## isNumeric(): bool
β
Check whether array is numeric or not.
**Parameters:**
__nothing__
**Return:**
- `bool Returns true if numeric, false otherwise.
` -------- ## isSequential(bool $recursive): bool β Check if the current array is sequential [0, 1, 2, 3, 4, 5 ...] or not. EXAMPLE:
a([0 => 'foo', 1 => 'lall', 2 => 'foobar'])->isSequential(); // true
INFO: If the array is empty we count it as non-sequential.
**Parameters:**
- `bool $recursive`
**Return:**
- `bool`
--------
## jsonSerialize(): array
β
**Parameters:**
__nothing__
**Return:**
- `array`
--------
## key(): int|string|null
β
Gets the key/index of the element at the current internal iterator position.
**Parameters:**
__nothing__
**Return:**
- `int|string|null`
--------
## keyExists(int|string $key): bool
β
Checks if the given key exists in the provided array.
INFO: This method only use "array_key_exists()" if you want to use "dot"-notation,
then you need to use "Arrayy->offsetExists()".
**Parameters:**
- `int|string $key the key to look for`
**Return:**
- `bool`
--------
## keys(bool $recursive, mixed|null $search_values, bool $strict): static
β
Get all keys from the current array.
EXAMPLE:
a([1 => 'foo', 2 => 'foo2', 3 => 'bar'])->keys(); // Arrayy[1, 2, 3]
**Parameters:**
- `bool $recursive [optional] Get all keys, also from all sub-arrays from an multi-dimensional array.
` - `null|T|T[] $search_values [optional]If specified, then only keys containing these values are returned.
` - `bool $strict [optional]Determines if strict comparison (===) should be used during the search.
` **Return:** - `static(Immutable) An array of all the keys in input.
` -------- ## krsort(int $sort_flags): $this β Sort an array by key in reverse order. **Parameters:** - `int $sort_flags [optional]You may modify the behavior of the sort using the optional parameter sort_flags, for details see sort.
` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## krsortImmutable(int $sort_flags): $this β Sort an array by key in reverse order. **Parameters:** - `int $sort_flags [optional]You may modify the behavior of the sort using the optional parameter sort_flags, for details see sort.
` **Return:** - `$this(Immutable)
` -------- ## ksort(int $sort_flags): $this β Sort the entries by key. **Parameters:** - `int $sort_flags [optional]You may modify the behavior of the sort using the optional parameter sort_flags, for details see sort.
` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## ksortImmutable(int $sort_flags): $this β Sort the entries by key. **Parameters:** - `int $sort_flags [optional]You may modify the behavior of the sort using the optional parameter sort_flags, for details see sort.
` **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## last(): mixed|null β Get the last value from the current array. EXAMPLE:
a([2 => 'foo', 3 => 'bar', 4 => 'lall'])->last(); // 'lall'
**Parameters:**
__nothing__
**Return:**
- `mixed|null Return null if there wasn't a element.
` -------- ## lastKey(): mixed|null β Get the last key from the current array. **Parameters:** __nothing__ **Return:** - `mixed|nullReturn null if there wasn't a element.
` -------- ## lastsImmutable(int|null $number): static β Get the last value(s) from the current array. EXAMPLE:
a([2 => 'foo', 3 => 'bar', 4 => 'lall'])->lasts(2); // Arrayy[0 => 'bar', 1 => 'lall']
**Parameters:**
- `int|null $number`
**Return:**
- `static (Immutable)
` -------- ## lastsMutable(int|null $number): $this β Get the last value(s) from the current array. EXAMPLE:
a([2 => 'foo', 3 => 'bar', 4 => 'lall'])->lasts(2); // Arrayy[0 => 'bar', 1 => 'lall']
**Parameters:**
- `int|null $number`
**Return:**
- `$this (Mutable)
` -------- ## length(int $mode): int β Count the values from the current array. alias: for "Arrayy->count()" **Parameters:** - `int $mode` **Return:** - `int` -------- ## map(callable $callable, bool $useKeyAsSecondParameter, mixed $arguments): static β Apply the given function to the every element of the array, collecting the results. EXAMPLE:
a(['foo', 'Foo'])->map('mb_strtoupper'); // Arrayy['FOO', 'FOO']
**Parameters:**
- `callable $callable`
- `bool $useKeyAsSecondParameter`
- `mixed ...$arguments`
**Return:**
- `static (Immutable) Arrayy object with modified elements.
` -------- ## matches(\Closure $closure): bool β Check if all items in current array match a truth test. EXAMPLE:
$closure = function ($value, $key) {
return ($value % 2 === 0);
};
a([2, 4, 8])->matches($closure); // true
**Parameters:**
- `\Closure(T , TKey ): bool $closure`
**Return:**
- `bool`
--------
## matchesAny(\Closure $closure): bool
β
Check if any item in the current array matches a truth test.
EXAMPLE:
$closure = function ($value, $key) {
return ($value % 2 === 0);
};
a([1, 4, 7])->matches($closure); // true
**Parameters:**
- `\Closure(T , TKey ): bool $closure`
**Return:**
- `bool`
--------
## max(): false|float|int|string
β
Get the max value from an array.
EXAMPLE:
a([-9, -8, -7, 1.32])->max(); // 1.32
**Parameters:**
__nothing__
**Return:**
- `false|float|int|string Will return false if there are no values.
` -------- ## mergeAppendKeepIndex(array $array, bool $recursive): static β Merge the new $array into the current array. - keep key,value from the current array, also if the index is in the new $array EXAMPLE:
$array1 = [1 => 'one', 'foo' => 'bar1'];
$array2 = ['foo' => 'bar2', 3 => 'three'];
a($array1)->mergeAppendKeepIndex($array2); // Arrayy[1 => 'one', 'foo' => 'bar2', 3 => 'three']
// ---
$array1 = [0 => 'one', 1 => 'foo'];
$array2 = [0 => 'foo', 1 => 'bar2'];
a($array1)->mergeAppendKeepIndex($array2); // Arrayy[0 => 'foo', 1 => 'bar2']
**Parameters:**
- `array $array`
- `bool $recursive`
**Return:**
- `static (Immutable)
` -------- ## mergeAppendNewIndex(array $array, bool $recursive): static β Merge the new $array into the current array. - replace duplicate assoc-keys from the current array with the key,values from the new $array - create new indexes EXAMPLE:
$array1 = [1 => 'one', 'foo' => 'bar1'];
$array2 = ['foo' => 'bar2', 3 => 'three'];
a($array1)->mergeAppendNewIndex($array2); // Arrayy[0 => 'one', 'foo' => 'bar2', 1 => 'three']
// ---
$array1 = [0 => 'one', 1 => 'foo'];
$array2 = [0 => 'foo', 1 => 'bar2'];
a($array1)->mergeAppendNewIndex($array2); // Arrayy[0 => 'one', 1 => 'foo', 2 => 'foo', 3 => 'bar2']
**Parameters:**
- `array $array`
- `bool $recursive`
**Return:**
- `static (Immutable)
` -------- ## mergePrependKeepIndex(array $array, bool $recursive): static β Merge the the current array into the $array. - use key,value from the new $array, also if the index is in the current array EXAMPLE:
$array1 = [1 => 'one', 'foo' => 'bar1'];
$array2 = ['foo' => 'bar2', 3 => 'three'];
a($array1)->mergePrependKeepIndex($array2); // Arrayy['foo' => 'bar1', 3 => 'three', 1 => 'one']
// ---
$array1 = [0 => 'one', 1 => 'foo'];
$array2 = [0 => 'foo', 1 => 'bar2'];
a($array1)->mergePrependKeepIndex($array2); // Arrayy[0 => 'one', 1 => 'foo']
**Parameters:**
- `array $array`
- `bool $recursive`
**Return:**
- `static (Immutable)
` -------- ## mergePrependNewIndex(array $array, bool $recursive): static β Merge the current array into the new $array. - replace duplicate assoc-keys from new $array with the key,values from the current array - create new indexes EXAMPLE:
$array1 = [1 => 'one', 'foo' => 'bar1'];
$array2 = ['foo' => 'bar2', 3 => 'three'];
a($array1)->mergePrependNewIndex($array2); // Arrayy['foo' => 'bar1', 0 => 'three', 1 => 'one']
// ---
$array1 = [0 => 'one', 1 => 'foo'];
$array2 = [0 => 'foo', 1 => 'bar2'];
a($array1)->mergePrependNewIndex($array2); // Arrayy[0 => 'foo', 1 => 'bar2', 2 => 'one', 3 => 'foo']
**Parameters:**
- `array $array`
- `bool $recursive`
**Return:**
- `static (Immutable)
` -------- ## meta(): ArrayyMeta|mixed|static β **Parameters:** __nothing__ **Return:** - `\ArrayyMeta|mixed|static` -------- ## min(): false|mixed β Get the min value from an array. EXAMPLE:
a([-9, -8, -7, 1.32])->min(); // -9
**Parameters:**
__nothing__
**Return:**
- `false|mixed Will return false if there are no values.
` -------- ## mostUsedValue(): mixed|null β Get the most used value from the array. **Parameters:** __nothing__ **Return:** - `mixed|null(Immutable) Return null if there wasn't an element.
` -------- ## mostUsedValues(int|null $number): static β Get the most used value from the array. **Parameters:** - `int|null $numberHow many values you will take?
` **Return:** - `static(Immutable)
` -------- ## moveElement(int|string $from, int $to): static β Move an array element to a new index. EXAMPLE:
$arr2 = new A(['A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e']);
$newArr2 = $arr2->moveElement('D', 1); // Arrayy['A' => 'a', 'D' => 'd', 'B' => 'b', 'C' => 'c', 'E' => 'e']
**Parameters:**
- `int|string $from`
- `int $to`
**Return:**
- `static (Immutable)
` -------- ## moveElementToFirstPlace(int|string $key): static β Move an array element to the first place. INFO: Instead of "Arrayy->moveElement()" this method will NOT loss the keys of an indexed array. **Parameters:** - `int|string $key` **Return:** - `static(Immutable)
` -------- ## moveElementToLastPlace(int|string $key): static β Move an array element to the last place. INFO: Instead of "Arrayy->moveElement()" this method will NOT loss the keys of an indexed array. **Parameters:** - `int|string $key` **Return:** - `static(Immutable)
` -------- ## natcasesort(): $this β Sort an array using a case insensitive "natural order" algorithm. **Parameters:** __nothing__ **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## natcasesortImmutable(): $this β Sort an array using a case insensitive "natural order" algorithm. **Parameters:** __nothing__ **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## natsort(): $this β Sort entries using a "natural order" algorithm. **Parameters:** __nothing__ **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## natsortImmutable(): $this β Sort entries using a "natural order" algorithm. **Parameters:** __nothing__ **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## next(): false|mixed β Moves the internal iterator position to the next element and returns this element. **Parameters:** __nothing__ **Return:** - `false|mixed(Mutable) Will return false if there are no values.
` -------- ## nth(int $step, int $offset): static β Get the next nth keys and values from the array. **Parameters:** - `int $step` - `int $offset` **Return:** - `static(Immutable)
` -------- ## offsetExists(bool|int|string $offset): bool β Whether or not an offset exists. **Parameters:** - `bool|int|string $offset` **Return:** - `bool` -------- ## offsetGet(int|string $offset): mixed β Returns the value at specified offset. **Parameters:** - `TKey $offset` **Return:** - `mixedWill return null if the offset did not exists.
` -------- ## offsetSet(int|string|null $offset, mixed $value): void β Assigns a value to the specified offset + check the type. **Parameters:** - `int|string|null $offset` - `mixed $value` **Return:** - `void` -------- ## offsetUnset(int|string $offset): void β Unset an offset. **Parameters:** - `int|string $offset` **Return:** - `void(Mutable) Return nothing.
` -------- ## only(int[]|string[] $keys): static β Get a subset of the items from the given array. **Parameters:** - `array-key[] $keys` **Return:** - `static(Immutable)
` -------- ## pad(int $size, mixed $value): static β Pad array to the specified size with a given value. **Parameters:** - `int $sizeSize of the result array.
` - `mixed $valueEmpty value by default.
` **Return:** - `static(Immutable) Arrayy object padded to $size with $value.
` -------- ## partition(\Closure $closure): arrayThe predicate on which to partition.
` **Return:** - `arrayAn array with two elements. The first element contains the array of elements where the predicate returned TRUE, the second element contains the array of elements where the predicate returned FALSE.
` -------- ## pop(): mixed|null β Pop a specified value off the end of the current array. **Parameters:** __nothing__ **Return:** - `mixed|null(Mutable) The popped element from the current array or null if the array is e.g. empty.
` -------- ## prepend(mixed $value, mixed $key): $this β Prepend a (key) + value to the current array. EXAMPLE:
a(['fΓ²Γ΄' => 'bΓ Ε'])->prepend('foo'); // Arrayy[0 => 'foo', 'fΓ²Γ΄' => 'bΓ Ε']
**Parameters:**
- `T $value`
- `TKey|null $key`
**Return:**
- `$this (Mutable) Return this Arrayy object, with the prepended value.
` -------- ## prependImmutable(mixed $value, mixed $key): $this β Prepend a (key) + value to the current array. EXAMPLE:
a(['fΓ²Γ΄' => 'bΓ Ε'])->prependImmutable('foo')->getArray(); // [0 => 'foo', 'fΓ²Γ΄' => 'bΓ Ε']
**Parameters:**
- `T $value`
- `TKey $key`
**Return:**
- `$this (Immutable) Return this Arrayy object, with the prepended value.
` -------- ## prependToEachKey(float|int|string $suffix): static β Add a suffix to each key. **Parameters:** - `float|int|string $suffix` **Return:** - `static(Immutable) Return an Arrayy object, with the prepended keys.
` -------- ## prependToEachValue(float|int|string $suffix): static β Add a suffix to each value. **Parameters:** - `float|int|string $suffix` **Return:** - `static(Immutable) Return an Arrayy object, with the prepended values.
` -------- ## pull(int|int[]|string|string[]|null $keyOrKeys, mixed $fallback): mixed β Return the value of a given key and delete the key. **Parameters:** - `int|int[]|string|string[]|null $keyOrKeys` - `TFallback $fallback` **Return:** - `mixed` -------- ## push(mixed $args): $this β Push one or more values onto the end of array at once. **Parameters:** - `array(Mutable) Return this Arrayy object, with pushed elements to the end of array.
` -------- ## randomImmutable(int|null $number): static β Get a random value from the current array. EXAMPLE:
a([1, 2, 3, 4])->randomImmutable(2); // e.g.: Arrayy[1, 4]
**Parameters:**
- `int|null $number How many values you will take?
` **Return:** - `static(Immutable)
` -------- ## randomKey(): mixed|null β Pick a random key/index from the keys of this array. EXAMPLE:
$arrayy = A::create([1 => 'one', 2 => 'two']);
$arrayy->randomKey(); // e.g. 2
**Parameters:**
__nothing__
**Return:**
- `mixed|null Get a key/index or null if there wasn't a key/index.
` -------- ## randomKeys(int $number): static β Pick a given number of random keys/indexes out of this array. EXAMPLE:
a([1 => 'one', 2 => 'two'])->randomKeys(); // e.g. Arrayy[1, 2]
**Parameters:**
- `int $number The number of keys/indexes (should be <= \count($this->array))
` **Return:** - `static(Immutable)
` -------- ## randomMutable(int|null $number): $this β Get a random value from the current array. EXAMPLE:
a([1, 2, 3, 4])->randomMutable(2); // e.g.: Arrayy[1, 4]
**Parameters:**
- `int|null $number How many values you will take?
` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## randomValue(): mixed β Pick a random value from the values of this array. EXAMPLE:
a([1 => 'one', 2 => 'two'])->randomValue(); // e.g. 'one'
**Parameters:**
__nothing__
**Return:**
- `mixed Get a random value or null if there wasn't a value.
` -------- ## randomValues(int $number): static β Pick a given number of random values out of this array. EXAMPLE:
a([1 => 'one', 2 => 'two'])->randomValues(); // e.g. Arrayy['one', 'two']
**Parameters:**
- `int $number`
**Return:**
- `static (Mutable)
` -------- ## randomWeighted(array $array, int $number): β **Parameters:** - `array $array` - `int $number` **Return:** - `self` -------- ## reduce(callable $callable, mixed $initial): static β Reduce the current array via callable e.g. anonymous-function and return the end result. EXAMPLE:
a([1, 2, 3, 4])->reduce(
function ($carry, $item) {
return $carry * $item;
},
1
); // Arrayy[24]
**Parameters:**
- `callable $callable`
- `T2 $initial`
**Return:**
- `static (Immutable)
` -------- ## reduce_dimension(bool $unique): static β **Parameters:** - `bool $unique` **Return:** - `static(Immutable)
` -------- ## reindex(): $this β Create a numerically re-indexed Arrayy object. EXAMPLE:
a([2 => 1, 3 => 2])->reindex(); // Arrayy[0 => 1, 1 => 2]
**Parameters:**
__nothing__
**Return:**
- `$this (Mutable) Return this Arrayy object, with re-indexed array-elements.
` -------- ## reject(\Closure $closure): static β Return all items that fail the truth test. EXAMPLE:
$closure = function ($value) {
return $value % 2 !== 0;
}
a([1, 2, 3, 4])->reject($closure); // Arrayy[1 => 2, 3 => 4]
**Parameters:**
- `\Closure(T , TKey ): bool $closure`
**Return:**
- `static (Immutable)
` -------- ## remove(mixed $key): static β Remove a value from the current array (optional using dot-notation). EXAMPLE:
a([1 => 'bar', 'foo' => 'foo'])->remove(1); // Arrayy['foo' => 'foo']
**Parameters:**
- `TKey|TKey[] $key`
**Return:**
- `static (Mutable)
` -------- ## removeElement(mixed $element): static β alias: for "Arrayy->removeValue()" **Parameters:** - `T $element` **Return:** - `static(Immutable)
` -------- ## removeFirst(): static β Remove the first value from the current array. EXAMPLE:
a([1 => 'bar', 'foo' => 'foo'])->removeFirst(); // Arrayy['foo' => 'foo']
**Parameters:**
__nothing__
**Return:**
- `static (Immutable)
` -------- ## removeLast(): static β Remove the last value from the current array. EXAMPLE:
a([1 => 'bar', 'foo' => 'foo'])->removeLast(); // Arrayy[1 => 'bar']
**Parameters:**
__nothing__
**Return:**
- `static (Immutable)
` -------- ## removeValue(mixed $value): static β Removes a particular value from an array (numeric or associative). EXAMPLE:
a([1 => 'bar', 'foo' => 'foo'])->removeValue('foo'); // Arrayy[1 => 'bar']
**Parameters:**
- `T $value`
**Return:**
- `static (Immutable)
` -------- ## repeat(int $times): static β Generate array of repeated arrays. **Parameters:** - `int $timesHow many times has to be repeated.
` **Return:** - `static(Immutable)
` -------- ## replace(mixed $oldKey, mixed $newKey, mixed $newValue): static β Replace a key with a new key/value pair. EXAMPLE:
$arrayy = a([1 => 'foo', 2 => 'foo2', 3 => 'bar']);
$arrayy->replace(2, 'notfoo', 'notbar'); // Arrayy[1 => 'foo', 'notfoo' => 'notbar', 3 => 'bar']
**Parameters:**
- `TKey $oldKey`
- `TKey $newKey`
- `T $newValue`
**Return:**
- `static (Immutable)
` -------- ## replaceAllKeys(int[]|string[] $keys): static β Create an array using the current array as values and the other array as keys. EXAMPLE:
$firstArray = [
1 => 'one',
2 => 'two',
3 => 'three',
];
$secondArray = [
'one' => 1,
1 => 'one',
2 => 2,
];
$arrayy = a($firstArray);
$arrayy->replaceAllKeys($secondArray); // Arrayy[1 => "one", 'one' => "two", 2 => "three"]
**Parameters:**
- `arrayAn array of keys.
` **Return:** - `static(Immutable) Arrayy object with keys from the other array, empty Arrayy object if the number of elements for each array isn't equal or if the arrays are empty.
` -------- ## replaceAllValues(array $array): static β Create an array using the current array as keys and the other array as values. EXAMPLE:
$firstArray = [
1 => 'one',
2 => 'two',
3 => 'three',
];
$secondArray = [
'one' => 1,
1 => 'one',
2 => 2,
];
$arrayy = a($firstArray);
$arrayy->replaceAllValues($secondArray); // Arrayy['one' => 1, 'two' => 'one', 'three' => 2]
**Parameters:**
- `array $array An array of values.
` **Return:** - `static(Immutable) Arrayy object with values from the other array, empty Arrayy object if the number of elements for each array isn't equal or if the arrays are empty.
` -------- ## replaceKeys(array $keys): static β Replace the keys in an array with another set. EXAMPLE:
a([1 => 'bar', 'foo' => 'foo'])->replaceKeys([1 => 2, 'foo' => 'replaced']); // Arrayy[2 => 'bar', 'replaced' => 'foo']
**Parameters:**
- `arrayAn array of keys matching the array's size.
` **Return:** - `static(Immutable)
` -------- ## replaceOneValue(mixed $search, mixed $replacement): static β Replace the first matched value in an array. EXAMPLE:
$testArray = ['bar', 'foo' => 'foo', 'foobar' => 'foobar'];
a($testArray)->replaceOneValue('foo', 'replaced'); // Arrayy['bar', 'foo' => 'replaced', 'foobar' => 'foobar']
**Parameters:**
- `T $search The value to replace.
` - `T $replacementThe value to replace.
` **Return:** - `static(Immutable)
` -------- ## replaceValues(string $search, string $replacement): static β Replace values in the current array. EXAMPLE:
$testArray = ['bar', 'foo' => 'foo', 'foobar' => 'foobar'];
a($testArray)->replaceValues('foo', 'replaced'); // Arrayy['bar', 'foo' => 'replaced', 'foobar' => 'replacedbar']
**Parameters:**
- `string $search The value to replace.
` - `string $replacementWhat to replace it with.
` **Return:** - `static(Immutable)
` -------- ## rest(int $from): static β Get the last elements from index $from until the end of this array. EXAMPLE:
a([2 => 'foo', 3 => 'bar', 4 => 'lall'])->rest(2); // Arrayy[0 => 'lall']
**Parameters:**
- `int $from`
**Return:**
- `static (Immutable)
` -------- ## reverse(): $this β Return the array in the reverse order. EXAMPLE:
a([1 => 1, 2 => 2, 3 => 3])->reverse(); // self[3, 2, 1]
**Parameters:**
__nothing__
**Return:**
- `$this (Mutable) Return this Arrayy object.
` -------- ## reverseKeepIndex(): $this β Return the array with keys in the reverse order. EXAMPLE:
a([1 => 1, 2 => 2, 3 => 3])->reverse(); // self[3 => 3, 2 => 2, 1 => 1]
**Parameters:**
__nothing__
**Return:**
- `$this (Mutable) Return this Arrayy object.
` -------- ## rsort(int $sort_flags): $this β Sort an array in reverse order. **Parameters:** - `int $sort_flags [optional]You may modify the behavior of the sort using the optional parameter sort_flags, for details see sort.
` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## rsortImmutable(int $sort_flags): $this β Sort an array in reverse order. **Parameters:** - `int $sort_flags [optional]You may modify the behavior of the sort using the optional parameter sort_flags, for details see sort.
` **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## searchIndex(mixed $value): false|int|string β Search for the first index of the current array via $value. EXAMPLE:
a(['fΓ²Γ΄' => 'bΓ Ε', 'lall' => 'bΓ Ε'])->searchIndex('bΓ Ε'); // Arrayy[0 => 'fΓ²Γ΄']
**Parameters:**
- `T $value`
**Return:**
- `false|int|string Will return FALSE if the value can't be found.
` -------- ## searchValue(mixed $index): static β Search for the value of the current array via $index. EXAMPLE:
a(['fΓ²Γ΄' => 'bΓ Ε'])->searchValue('fΓ²Γ΄'); // Arrayy[0 => 'bΓ Ε']
**Parameters:**
- `TKey $index`
**Return:**
- `static (Immutable) Will return a empty Arrayy if the value wasn't found.
` -------- ## serialize(): string β Serialize the current "Arrayy"-object. EXAMPLE:
a([1, 4, 7])->serialize();
**Parameters:**
__nothing__
**Return:**
- `string`
--------
## set(string $key, mixed $value): $this
β
Set a value for the current array (optional using dot-notation).
EXAMPLE:
$arrayy = a(['Lars' => ['lastname' => 'Moelleken']]);
$arrayy->set('Lars.lastname', 'MΓΌller'); // Arrayy['Lars', ['lastname' => 'MΓΌller']]]
**Parameters:**
- `TKey $key The key to set.
` - `T $valueIts value.
` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## setAndGet(mixed $key, mixed $fallback): mixed β Get a value from a array and set it if it was not. WARNING: this method only set the value, if the $key is not already set EXAMPLE:
$arrayy = a([1 => 1, 2 => 2, 3 => 3]);
$arrayy->setAndGet(1, 4); // 1
$arrayy->setAndGet(0, 4); // 4
**Parameters:**
- `TKey $key The key
` - `T $fallbackThe default value to set if it isn't.
` **Return:** - `mixed(Mutable)
` -------- ## setFlags(int $flags): β **Parameters:** - `int $flags` **Return:** - `TODO: __not_detected__` -------- ## setIteratorClass(string $iteratorClass): void β Sets the iterator classname for the current "Arrayy"-object. **Parameters:** - `class-string<\Arrayy\ArrayyIterator> $iteratorClass` **Return:** - `void` -------- ## shift(): mixed|null β Shifts a specified value off the beginning of array. **Parameters:** __nothing__ **Return:** - `mixed|null(Mutable) A shifted element from the current array.
` -------- ## shuffle(bool $secure, array|null $array): static β Shuffle the current array. EXAMPLE:
a([1 => 'bar', 'foo' => 'foo'])->shuffle(); // e.g.: Arrayy[['foo' => 'foo', 1 => 'bar']]
**Parameters:**
- `bool $secure using a CSPRNG | @see https://paragonie.com/b/JvICXzh_jhLyt4y3
` - `array|null $array [optional]` **Return:** - `static(Immutable)
` -------- ## size(int $mode): int β Count the values from the current array. alias: for "Arrayy->count()" **Parameters:** - `int $mode` **Return:** - `int` -------- ## sizeIs(int $size): bool β Checks whether array has exactly $size items. **Parameters:** - `int $size` **Return:** - `bool` -------- ## sizeIsBetween(int $fromSize, int $toSize): bool β Checks whether array has between $fromSize to $toSize items. $toSize can be smaller than $fromSize. **Parameters:** - `int $fromSize` - `int $toSize` **Return:** - `bool` -------- ## sizeIsGreaterThan(int $size): bool β Checks whether array has more than $size items. **Parameters:** - `int $size` **Return:** - `bool` -------- ## sizeIsLessThan(int $size): bool β Checks whether array has less than $size items. **Parameters:** - `int $size` **Return:** - `bool` -------- ## sizeRecursive(): int β Counts all elements in an array, or something in an object.For objects, if you have SPL installed, you can hook into count() by implementing interface {@see \Countable}. The interface has exactly one method, {@see \Countable::count()}, which returns the return value for the count() function. Please see the {@see \Array} section of the manual for a detailed explanation of how arrays are implemented and used in PHP.
**Parameters:** __nothing__ **Return:** - `intThe number of elements in var, which is typically an array, since anything else will have one element.
If var is not an array or an object with implemented Countable interface, 1 will be returned. There is one exception, if var is &null;, 0 will be returned.
Caution: count may return 0 for a variable that isn't set, but it may also return 0 for a variable that has been initialized with an empty array. Use isset to test if a variable is set.
` -------- ## slice(int $offset, int|null $length, bool $preserveKeys): static β Extract a slice of the array. **Parameters:** - `int $offsetSlice begin index.
` - `int|null $lengthLength of the slice.
` - `bool $preserveKeysWhether array keys are preserved or no.
` **Return:** - `static(Immutable) A slice of the original array with length $length.
` -------- ## sort(int|string $direction, int $strategy, bool $keepKeys): static β Sort the current array and optional you can keep the keys. EXAMPLE:
a(3 => 'd', 2 => 'f', 0 => 'a')->sort(SORT_ASC, SORT_NATURAL, false); // Arrayy[0 => 'a', 1 => 'd', 2 => 'f']
**Parameters:**
- `int|string $direction use SORT_ASC (default) or SORT_DESC
` - `int $strategysort_flags => use e.g.: SORT_REGULAR (default) or SORT_NATURAL
` - `bool $keepKeys` **Return:** - `static(Mutable) Return this Arrayy object.
` -------- ## sortImmutable(int|string $direction, int $strategy, bool $keepKeys): static β Sort the current array and optional you can keep the keys. **Parameters:** - `int|string $directionuse SORT_ASC (default) or SORT_DESC
` - `int $strategysort_flags => use e.g.: SORT_REGULAR (default) or SORT_NATURAL
` - `bool $keepKeys` **Return:** - `static(Immutable) Return this Arrayy object.
` -------- ## sortKeys(int|string $direction, int $strategy): $this β Sort the current array by key. EXAMPLE:
a([1 => 2, 0 => 1])->sortKeys(\SORT_ASC); // Arrayy[0 => 1, 1 => 2]
**Parameters:**
- `int|string $direction use SORT_ASC (default) or SORT_DESC
` - `int $strategyuse e.g.: SORT_REGULAR (default) or SORT_NATURAL
` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## sortKeysImmutable(int|string $direction, int $strategy): $this β Sort the current array by key. **Parameters:** - `int|string $directionuse SORT_ASC (default) or SORT_DESC
` - `int $strategyuse e.g.: SORT_REGULAR (default) or SORT_NATURAL
` **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## sortValueKeepIndex(int|string $direction, int $strategy): static β Sort the current array by value. EXAMPLE:
a(3 => 'd', 2 => 'f', 0 => 'a')->sortValueKeepIndex(SORT_ASC, SORT_REGULAR); // Arrayy[0 => 'a', 3 => 'd', 2 => 'f']
**Parameters:**
- `int|string $direction use SORT_ASC (default) or SORT_DESC
` - `int $strategyuse e.g.: SORT_REGULAR (default) or SORT_NATURAL
` **Return:** - `static(Mutable)
` -------- ## sortValueNewIndex(int|string $direction, int $strategy): static β Sort the current array by value. EXAMPLE:
a(3 => 'd', 2 => 'f', 0 => 'a')->sortValueNewIndex(SORT_ASC, SORT_NATURAL); // Arrayy[0 => 'a', 1 => 'd', 2 => 'f']
**Parameters:**
- `int|string $direction use SORT_ASC (default) or SORT_DESC
` - `int $strategyuse e.g.: SORT_REGULAR (default) or SORT_NATURAL
` **Return:** - `static(Mutable)
` -------- ## sorter(callable|mixed|null $sorter, int|string $direction, int $strategy): static β Sort a array by value or by a closure. - If the sorter is null, the array is sorted naturally. - Associative (string) keys will be maintained, but numeric keys will be re-indexed. EXAMPLE:
$testArray = range(1, 5);
$under = a($testArray)->sorter(
function ($value) {
return $value % 2 === 0;
}
);
var_dump($under); // Arrayy[1, 3, 5, 2, 4]
**Parameters:**
- `callable|mixed|null $sorter`
- `int|string $direction use SORT_ASC (default) or SORT_DESC
` - `int $strategyuse e.g.: SORT_REGULAR (default) or SORT_NATURAL
` **Return:** - `static(Immutable)
` -------- ## splice(int $offset, int|null $length, array $replacement): static β **Parameters:** - `int $offset` - `int|null $length` - `array(Immutable)
` -------- ## split(int $numberOfPieces, bool $keepKeys): static β Split an array in the given amount of pieces. EXAMPLE:
a(['a' => 1, 'b' => 2])->split(2, true); // Arrayy[['a' => 1], ['b' => 2]]
**Parameters:**
- `int $numberOfPieces`
- `bool $keepKeys`
**Return:**
- `static (Immutable)
` -------- ## stripEmpty(): static β Strip all empty items from the current array. EXAMPLE:
a(['a' => 1, 'b' => ''])->stripEmpty(); // Arrayy[['a' => 1]]
**Parameters:**
__nothing__
**Return:**
- `static (Immutable)
` -------- ## swap(int|string $swapA, int|string $swapB): static β Swap two values between positions by key. EXAMPLE:
a(['a' => 1, 'b' => ''])->swap('a', 'b'); // Arrayy[['a' => '', 'b' => 1]]
**Parameters:**
- `int|string $swapA a key in the array
` - `int|string $swapBa key in the array
` **Return:** - `static(Immutable)
` -------- ## toArray(bool $convertAllArrayyElements, bool $preserveKeys): array β Get the current array from the "Arrayy"-object. alias for "getArray()" **Parameters:** - `bool $convertAllArrayyElementsConvert all Child-"Arrayy" objects also to arrays.
` - `bool $preserveKeyse.g.: A generator maybe return the same key more than once, so maybe you will ignore the keys.
` **Return:** - `array` -------- ## toJson(int $options, int $depth): string β Convert the current array to JSON. EXAMPLE:
a(['bar', ['foo']])->toJson(); // '["bar",{"1":"foo"}]'
**Parameters:**
- `int $options [optional] e.g. JSON_PRETTY_PRINT
` - `int $depth [optional]Set the maximum depth. Must be greater than zero.
` **Return:** - `string` -------- ## toList(bool $convertAllArrayyElements): array β Get the current array from the "Arrayy"-object as list. **Parameters:** - `bool $convertAllArrayyElementsConvert all Child-"Arrayy" objects also to arrays.
` **Return:** - `array` -------- ## toPermutation(string[]|null $items, string[] $helper): static|static[] β **Parameters:** - `string[]|null $items [optional]` - `string[] $helper [optional]` **Return:** - `static|static[]` -------- ## toString(string $separator): string β Implodes array to a string with specified separator. **Parameters:** - `string $separator [optional]The element's separator.
` **Return:** - `stringThe string representation of array, separated by ",".
` -------- ## uasort(callable $callable): $this β Sort the entries with a user-defined comparison function and maintain key association. **Parameters:** - `callable $callable` **Return:** - `$this(Mutable) Return this Arrayy object.
` -------- ## uasortImmutable(callable $callable): $this β Sort the entries with a user-defined comparison function and maintain key association. **Parameters:** - `callable $callable` **Return:** - `$this(Immutable) Return this Arrayy object.
` -------- ## uksort(callable $callable): static β Sort the entries by keys using a user-defined comparison function. **Parameters:** - `callable $callable` **Return:** - `static(Mutable) Return this Arrayy object.
` -------- ## uksortImmutable(callable $callable): static β Sort the entries by keys using a user-defined comparison function. **Parameters:** - `callable $callable` **Return:** - `static(Immutable) Return this Arrayy object.
` -------- ## unique(): static β alias: for "Arrayy->uniqueNewIndex()" **Parameters:** __nothing__ **Return:** - `static(Mutable) Return this Arrayy object, with the appended values.
` -------- ## uniqueKeepIndex(): $this β Return a duplicate free copy of the current array. (with the old keys) EXAMPLE:
a([2 => 1, 3 => 2, 4 => 2])->uniqueNewIndex(); // Arrayy[2 => 1, 3 => 2]
**Parameters:**
__nothing__
**Return:**
- `$this (Mutable)
` -------- ## uniqueNewIndex(): $this β Return a duplicate free copy of the current array. EXAMPLE:
a([2 => 1, 3 => 2, 4 => 2])->uniqueNewIndex(); // Arrayy[1, 2]
**Parameters:**
__nothing__
**Return:**
- `$this (Mutable)
` -------- ## unserialize(string $string): $this β Unserialize an string and return the instance of the "Arrayy"-class. EXAMPLE:
$serialized = a([1, 4, 7])->serialize();
a()->unserialize($serialized);
**Parameters:**
- `string $string`
**Return:**
- `$this`
--------
## unshift(mixed $args): $this
β
Prepends one or more values to the beginning of array at once.
**Parameters:**
- `array(Mutable) Return this Arrayy object, with prepended elements to the beginning of array.
` -------- ## validate(\Closure $closure): bool β Tests whether the given closure return something valid for all elements of this array. **Parameters:** - `\Closure(T , TKey ): bool $closure the predicate` **Return:** - `boolTRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
` -------- ## values(): static β Get all values from a array. EXAMPLE:
$arrayy = a([1 => 'foo', 2 => 'foo2', 3 => 'bar']);
$arrayyTmp->values(); // Arrayy[0 => 'foo', 1 => 'foo2', 2 => 'bar']
**Parameters:**
__nothing__
**Return:**
- `static (Immutable)
` -------- ## walk(callable $callable, bool $recursive, mixed $userData): $this β Apply the given function to every element in the array, discarding the results. EXAMPLE:
$callable = function (&$value, $key) {
$value = $key;
};
$arrayy = a([1, 2, 3]);
$arrayy->walk($callable); // Arrayy[0, 1, 2]
**Parameters:**
- `callable $callable`
- `bool $recursive [optional] Whether array will be walked recursively or no
` - `mixed $userData [optional]If the optional $userData parameter is supplied, it will be passed as the third parameter to the $callable.
` **Return:** - `$this(Mutable) Return this Arrayy object, with modified elements.
` -------- ## where(string $keyOrPropertyOrMethod, mixed $value): static β Returns a collection of matching items. **Parameters:** - `string $keyOrPropertyOrMethodThe property or method to evaluate.
` - `mixed $valueThe value to match.
` **Return:** - `static` -------- ---append | asort | count | exchangeArray |
getArrayCopy | getFlags | getIterator | getIteratorClass |
ksort | natcasesort | natsort | offsetExists |
offsetGet | offsetSet | offsetUnset | serialize |
setFlags | setIteratorClass | uasort | uksort |
unserialize |
All versions of arrayy with dependencies
ext-json Version *
symfony/polyfill-mbstring Version ~1.0
phpdocumentor/reflection-docblock Version ~4.3 || ~5.0