How can I use the array_reduce function to apply a function to each element of an array and reduce it to a single value in PHP? Example code: - Biz Tech

How can I use the array_reduce function to apply a function to each element of an array and reduce it to a single value in PHP? Example code:

Listen
$numbers = array(1, 2, 3, 4, 5);

$sum = array_reduce($numbers, function($accumulator, $current_value) { return $accumulator + $current_value; });

echo $sum;