Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 591 Bytes

File metadata and controls

37 lines (27 loc) · 591 Bytes

each

Description

Apply a function over all the items of a collection

Parameters

fn
Function to apply to every item in the collection.
coll
Collection of values to apply the function.

Examples

Save a bunch of entities:

<?php

use function Lambdish\Phunctional\each;


return each(
    function (User $user) use (UserRepository $repository) {
        $repository->save($user);
    },
    [
        User::register('Horus'),
        User::register('Osiris'),
        User::register('Isis'),
    ]
);

// => null