PHP code example of crocodile2u / chainy
1. Go to this page and download the library: Download crocodile2u/chainy 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/ */
crocodile2u / chainy example snippets
$array = array_filter($array);
$array = array_map(
$array,
function($element) {
// ... manipulations ...
return $modifiedElement;
}
);
sort($array);
$chain = (new \chainy\Chain)
->filter()
->map(
function($element) {
// ... manipulations ...
return $modifiedElement;
}
)
->sort();
$array = $chain->apply($array);
$chain = (new \chainy\Chain)
+------> filter() --+
| |
| +--------------+
| |
| +-> map(function()...) --+
| |
| +------------------------+
| |
| +-> sort();
|
| $array = $chain->apply($array);
| |
|--------------------------+