fetch / array-utils
Array utility methods, inspired by Ruby's array methods
0.1.1
2015-11-14 11:40 UTC
Requires (Dev)
- phpunit/phpunit: ~4.5
This package is auto-updated.
Last update: 2024-11-12 12:17:56 UTC
README
This is a set of utility functions for array alteration and handling.
They all follow the same naming conventions as the default methods in the form of array_*
.
Functions
array_delete(array &$array, $key)
Deletes entry from array and return its value.
NB: This method modifies the original variable.
array_get(array $array, $key)
Lookup entry in array by key and return its value, returns false
if not found.
array_flatten(array $array)
Make multidimensional array flat.
array_pick(array $array, $keys[, $key[, $key]])
Return array with only the keys in $keys
.
array_reject(array $array, $keys[, $key[, $key]])
Return array without the keys in $keys
.
This is the inverse of array_pick
Contributing
- Fork it ( https://github.com/fetch/php-array-utils/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request