Download the PHP package dormilich/extended-array-object without Composer
On this page you can find all versions of the php package dormilich/extended-array-object. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dormilich/extended-array-object
More information about dormilich/extended-array-object
Files in dormilich/extended-array-object
Package extended-array-object
Short Description Bringing array functions to the ArrayObject
License GPL v2.0
Informations about the package extended-array-object
extended-array-object
PHP’s array functions brought into php objects.
The intention of this project is to extend the native ArrayObject
with further array functions and
provide an easy way to apply subsequent array operations (like filter, map, diff, intersect) in a
concise way.
So far the spotlight is on working with single dimensional arrays. Recursive functions may be included in another project.
Function Overview
the following functions are supported:
Functions with identical behaviour and syntax
array_change_key_case()
aschangeKeyCase()
in_array()
ascontains()
array_count_values()
ascountValues()
array_filter()
asfilter()
array_flip()
asflip()
implode()
asjoin()
array_keys()
askeys()
array_pop()
aspop()
array_push()
aspush()
array_reverse()
asreverse()
array_search()
assearch()
array_shift()
asshift()
shuffle()
array_slice()
asslice()
array_splice()
assplice()
array_unique()
asunique()
array_unshift()
asunshift()
array_values()
asvalues()
Some methods have been renamed to better describe their functionality
array_merge()
asconcat()
array_replace()
asmerge()
Functions with slightly modified behaviour or syntax
array_map()
asmap()
, it does no accept multiple arrays. Instead it will always pass the keys and values to the callback.array_rand()
asrand()
, it returns the array elements instead of only the keys.array_reduce()
asreduce()
, if no initial value is given, the first array element is used as initial value.*sort()
, the native sort methods (ksort/asort) are extended to return the object instance.array_walk()
aswalk()
, if no userdata are given, the array itself is injected as userdata.
Functions with drastically changed behaviour or syntax
array_diff_*()
asdiff()
,kdiff()
, andadiff()
array_intersect_*()
asintersect()
,kintersect()
, andaintersect()
replace()
is a new function that works likearray_replace()
only without appending excess data.
Improved Error Handling
All methods throw exceptions when they encounter an error. This effectively allows to chain the methods together.
Examples
- Filtering for duplicate data in a POST variable