What will be the output of the following PHP code?
<?php
$number = array ("4", "hello", 2);
echo (array_sum ($number));
?>
<?php
$number = array ("4", "hello", 2);
echo (array_sum ($number));
?>
A. 4hello2
B. 4
C. 2
D. 6
Answer: Option D
Solution(By Examveda Team)
The array_sum() function add all the values of the input array together, returning the final sum. If a string datatype is found, it’ll be ignored.Related Questions on Arrays
A. karnataka 11,35,000
B. 11,35,000
C. population 11,35,000
D. karnataka population
Which function will return true if a variable is an array or false if it is not?
A. this_array()
B. is_array()
C. do_array()
D. in_array()
Join The Discussion