1. Go to this page and download the library: Download bcc/enumerable-utility 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/ */
bcc / enumerable-utility example snippets
php
use BCC\EnumerableUtility\Collection;
$values = new Collection(array(1, 2, 3));
// gets event/odd values
$values->where(function($item) { return $item % 2; });
// project the squared values
$values->select(function($item) { return $item*$item; });
// order
$values->orderByDescending();
// paginate
$values->skip(30)->take(10);
php
use BCC\EnumerableUtility\String;
$string = new String('Hello world!');
$string = $string->replace('world', 'pineapple') // replace world by pineapple
->toUpper() // to upper case
->skip(6) // skip the 6 first letters
->takeWhile(function($char) { $char != '!'; }); // take the rest while the char is different from '!'
echo $string; // PINEAPPLE
php
use \BCC\EnumerableUtility\StringUtility;
$string = 'Hello world!';
$string = StringUtility::replace ($string, 'world', 'pineapple'); // replace world by pineapple
$string = StringUtility::toUpper ($string); // to upper case
$string = StringUtility::skip ($string, 6); // skip the 6 first letters
$string = StringUtility::takeWhile($string, function($char) { $char != '!'; }); // take the rest while the char is different from '!'
echo $string; // PINEAPPLE
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.