typedphp / array-functions
0.1.0
2014-12-16 10:40 UTC
Requires
- php: >=5.4.0
- typedphp/number-functions: *
Requires (Dev)
- phpunit/phpunit: 4.*
README
Example
use TypedPHP\Functions\ArrayFunctions; ArrayFunctions\map([1, 2, 3], function($item) { return $item * 2; }); // [2, 4, 6] ArrayFunctions\contains(["foo", "bar", "baz"], "bar"); // true
Functions:
contains(array $haystack, $needle) → bool
each(array $array, callable $callback) → array
exclude(array $array, array $exclude) → array
filter(array $array, callable $callback) → array
length(array $array) → int
has(array $array, $needle) → bool
join(array $array, $glue) → string
map(array $array, callable $callback) → array
merge(array $array, array $merge) → array
slice(array $array, $offset = 0, $limit = 0) → array
random(array $array) → mixed
Caveats:
- Nope
Installation
❯ composer require "typedphp/array-functions:*"
Testing
❯ composer create-project "typedphp/array-functions:*" . ❯ vendor/bin/phpunit