void|array iterate(array|Traversable $list, bool $collect = false)
function iterate($list, $collect = false) { if ($collect) $result = array(); foreach ($list as $element) { if ($collect) $result[] = $element; } if ($collect) return $result; }