1. Go to this page and download the library: Download camspiers/php-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/ */
camspiers / php-fp example snippets
// Create a curryable function
$concat = fp\curry(function ($a, $b) { return $a . $b; });
// Create a new function with 'Mr. ' applied
$addTitle = $concat('Mr. ');
echo $addTitle('Spiers');
// Mr. Spiers
$h = fp\compose($f, $g);
$map = fp\curry('array_map');
function _tag($tag, $text) {
return "<$tag>$text</$tag>";
}
function tag(...$args) {
return fp\curry('_tag')->__invoke(...$args);
}
// We now have a paragraph function
$p = tag('p');
// We now have a div function
$div = tag('div');
echo $div($p("Some text"));
// <div><p>Some text</p></div>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.