Skip to content

Latest commit

History

History
23 lines (19 loc) 路 535 Bytes

File metadata and controls

23 lines (19 loc) 路 535 Bytes

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?

functionreducer($total,聽$elt) {
    return$elt聽+聽$total;
}
$arr聽=聽[1,聽2,聽3,聽4,聽5];
echoarray_reduce($arr,聽'reducer',聽1);
  • A) 16
  • B) 14
  • C) 0
  • D) 15
Answer

Answer: A