YaLinqo\Enumerable::each PHP Method

each() public method

Syntax: each (action {(v, k) ==> void})

Each method forces enumeration. To just add side-effect without enumerating, you can use {@link process} method.

Original LINQ method name: foreach.

public each ( callable $action = null )
$action callable {(v, k) ==> void} The action to invoke for each element in the sequence.
    public function each($action = null)
    {
        $action = Utils::createLambda($action, 'v,k', Functions::$blank);
        foreach ($this as $k => $v) {
            $action($v, $k);
        }
    }