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


$add = fn($x) => fn($y) => $x + $y;
$fn = flow($add(1), $add(2), $add(4));
$fn(0); // => 7

$add = fn($x) => fn($y) => $x + $y;
pipe(0, $add(1), $add(2), $add(4)); // => 7

$add = fn($x) => fn($y) => $x + $y;
$fn = compose($add(1), $add(2), $add(3));
$fn(0); // => 6