thumbtack/crankshaft

This package is abandoned and no longer maintained. No replacement package was suggested.

Iteration Utils for PHP similar to Python itertools

dev-master 2014-06-06 02:02 UTC

This package is not auto-updated.

Last update: 2023-09-30 10:59:11 UTC


README

A PHP version of Python's itertools.

Supported functions include map, filter, each, and reduce.

Basic usage:

require_once('crankshaft.php');

$a = tt_iter([1, 2, 3])
    ->map(function($x) { return 2 * x; })
    ->to_array();

// $a is now [2, 4, 8]

Running Tests

This requires simpletest to be installed.