PHP code example of ashrafakl / array-container

1. Go to this page and download the library: Download ashrafakl/array-container 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/ */

    

ashrafakl / array-container example snippets




use ashrafakl\tools\arrays\ArrayContainer;

(new ArrayContainer([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
    ->map(function ($val) {
        return pow(2, $val);
    })
    ->filter(function ($val) {
        return $val > 70;
    })
    ->order(function ($list) {
        array_multisort($list, SORT_DESC, SORT_REGULAR);
        return $list;
    })
    ->unshift(5, 9)
    ->forEach(function ($value, $index) {
    echo "{$index}|{$value}" . PHP_EOL;
});


php composer.phar 

"ashrafakl/array-container": "~1.0.0"