<<< Previous question <<< Question ID#0391.md >>> Next question >>>
The PHP function array_reduce() is used to turn an array into a single value using a custom callback. What is the output of the following script?
function聽reducer($total,聽$elt) {
return聽$elt聽+聽$total;
}
$arr聽=聽[1,聽2,聽3,聽4,聽5];
echo聽array_reduce($arr,聽'reducer',聽1);- A) 16
- B) 14
- C) 0
- D) 15
Answer
Answer: A