jlaso/iterators

多个迭代器

dev-master 2016-10-02 17:17 UTC

This package is auto-updated.

Last update: 2024-09-15 10:26:45 UTC


README

安装

composer require jlaso/itearators

variable-iterator

简化了使用复杂数组遍历所有可能性的方法

如何使用

use JLaso\Iterators\VariableIterator;

$iterator = new VariableIterator([
    'genre' => ['W', 'M', '?'],
    'ages' => ['18-25', '26-58', '+59'],
    'profession' => ['engineer', 'services', 'others'],
    'holidays' => ['none', '1-10', '+10'],
]);

foreach ($iterator as $item) {
    // you have in every $item the current mix of variations
}

单元测试

vendor/bin/phpunit