PHP code example of burdock / php-utils

1. Go to this page and download the library: Download burdock/php-utils 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/ */

    

burdock / php-utils example snippets


$addOne = new NamedJob('addOne', function($value) {
    return $value + 1;
});

$addTwo = new NamedJob('addTwo', function($value) {
    return $value + 2;
});

$sum = new NamedJob('sum', function($value, ...$args) {
    return array_reduce(array_merge([$value], $args), function($carry, $item) {
        return $carry + $item;
    });
});

$chain = (new Chain(55))
     ->process($addOne)
     ->process($addTwo)
     ->process($sum, 3, 4)

echo $chain->getValue() . EOL; // returns 65