Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php reduce

$numbers = [1,2,3,4,5];

function add ($array) {
    return array_reduce($array, fn($acc, $val) => $acc + $val, 0);
}

echo add($numbers);
 
PREVIOUS NEXT
Tagged: #php #reduce
ADD COMMENT
Topic
Name
5+8 =