typedphp/array-functions

0.1.0 2014-12-16 10:40 UTC

This package is auto-updated.

Last update: 2024-12-19 02:26:26 UTC


README

Build Status Code Quality Code Coverage Version License

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