PHP code example of hassan / one-loop
1. Go to this page and download the library: Download hassan/one-loop library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hassan / one-loop example snippets
php
$users = App\User::all();
$ids = one_loop($users)->reject(static function ($user) {
return $user->age < 20;
})
->map(static function ($user) {
return $user->id;
})
->apply();