ali-eltaweel/cartesian-product

There is no license information available for the latest version (1.0.0) of this package.

PHP Iterables Cartesian Product

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/ali-eltaweel/cartesian-product

1.0.0 2025-07-21 20:32 UTC

This package is auto-updated.

Last update: 2025-10-21 21:03:07 UTC


README

PHP Iterables Cartesian Product

Installation

composer require ali-eltaweel/cartesian-product

Usage

use CartesianProduct\CartesianProduct;

$cp = new CartesianProduct();

$cp->add(['a', 'b', 'c']);
$cp->add(['1', '2', '3']);
$cp->add(['+', '-', '*']);

foreach ($cp as $combination) {

    // ...
}

With keys

use CartesianProduct\CartesianProduct;

$cp = new CartesianProduct();

$cp->add(['a', 'b', 'c'], 'letter');
$cp->add(['1', '2', '3'], 'number');
$cp->add(['+', '-', '*'], 'symbol');

foreach ($cp as $combination) {

    // ...
}