Skip to main content
PHP Output Prediction Medium +20 XP

Array Functions

What is the output?

PHPRead-only
$arr = [3, 1, 4, 1, 5];
echo count($arr) . "-" . array_sum($arr);

What is the output?

Show answer and explanation

Answer: 5-14

count([3,1,4,1,5]) = 5, array_sum([3,1,4,1,5]) = 14.

Hint: Count elements and sum them.

What this challenge tests

Output Prediction in PHP: arrays, functions.

Related challenges