PHP code example of emonkak / underbar.php
1. Go to this page and download the library: Download emonkak/underbar.php 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/ */
emonkak / underbar.php example snippets
// There are also ArrayImpl and GeneratorImpl.
use Underbar\IteratorImpl as _;
// Take five elements from a infinite list of even numbers.
_::chain(0)
->iterate(function($n) { return $n + 1; })
->filter(function($n) { return $n % 2 === 0; })
->take(5)
->each(function($n) { echo $n, PHP_EOL; });
// => 0
// 2
// 4
// 6
// 8
// Get a first element.
echo _::first(array(100)), PHP_EOL;
// => 100