Enables functional style syntax eg $list->filter($cb)->map($cb2)

v0.1.0 2019-06-04 03:03 UTC

This package is not auto-updated.

Last update: 2024-04-18 01:34:40 UTC


README

Problem

You have an array and you need to remove anything that is not a number and double everything else.

Solution

$a = kdaviesnz/utilities/lists([null, "apple", 1,2,3]);

$result = $a->filter(function($item) { return is_numeric($item) } )->map(function($item) { return $item * 2 } )()

$a_parsed = $result()

See tests/listsTest.php

lists