kdaviesnz / list
Enables functional style syntax eg $list->filter($cb)->map($cb2)
v0.1.0
2019-06-04 03:03 UTC
Requires
- php: >=7.0.0
- phpunit/phpunit: 8.1.6
This package is not auto-updated.
Last update: 2025-03-06 05:48:52 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