PHP code example of bendamqui / fp

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

    

bendamqui / fp example snippets


function add($x) {
    return function($y) use ($x) {
        return $x + $y;
    };
}
pipe(add(1), add(2), add(4))(0); // => 7

function add($x) {
    return function($y) use ($x) {
        return $x + $y;
    };
}
compose(add(1), add(2), add(3))(0); // => 6