rfc:functional-elements:iterate

function iterate()

Prototype

void|array iterate(array|Traversable $list, bool $collect = false)

Example implementation

function iterate($list, $collect = false)
{
    if ($collect) $result = array();
    foreach ($list as $element) {
        if ($collect) $result[] = $element;
    }
    if ($collect) return $result;
}
rfc/functional-elements/iterate.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1