pldin601/php-funky

There is no license information available for the latest version (1.0) of this package.

Functional Library for PHP

1.0 2016-03-08 20:42 UTC

This package is not auto-updated.

Last update: 2024-05-25 16:06:53 UTC


README

Functional Library for PHP.

Consist of two parts - Option and Lambda.

Option

Option is an object that represents encapsulation of an optional value. It can be used as the return value of functions which may or may not return a meaningful value when they are applied. It has two subclasses - Some and None. First encapsulates the original data and the second if there is no data to encapsulate.

Lambda

Lambda is a tool which helps you to make short callback functions for using, for example, in map, filter, sort or reduce callbacks.

Example 1. Will return sum of numbers from 1 up to 5:

$sum = array_reduce(range(1, 5), func("$ + $"), 0);