1. Go to this page and download the library: Download nsilbernagel/accumulatephp 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/ */
nsilbernagel / accumulatephp example snippets
// create empty list
$series = ArraySeries::new();
// create list with elements 1,2 and 3
$series = ArraySeries::of(1,2,3);
// add 4
$series->add(4);
// remove 4th element
$series->remove(3);
// filter list for event number
$evenNumbers = $series->filter(fn(int $number) => $number % 2 === 0)
// map list, multiplay all elements by 2
$multiplied = $series->map(fn(int $number) => $number*2)