Login
Remember
Register
Gaurav Agarwal Q&A Hub
Questions
Unanswered
Tags
Categories
Users
Ask a Question
Ask a Question
Write a php program to find the sum of all elements in an array.
0
votes
asked
Jun 18, 2024
by
digitalgaurav
(
1.2k
points)
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jun 18, 2024
by
digitalgaurav
(
1.2k
points)
<?php
$arr = array(1, 2, 3, 4, 5);
$sum = array_sum($arr);
echo "Sum: " . $sum;
?>
Please
log in
or
register
to add a comment.
Welcome to Gaurav Agarwal Q&A Hub, where you can ask questions and receive answers from other members of the community.
Related questions
Write a PHP program to find the maximum and minimum elements in an array.
Write a php program to apply a callback function to all elements of an array.
Write a php program to count the frequency of each element in an array.
Write a php program to reverse the elements of an array.
Write a php program to split an array into chunks of 2 elements each.
Write a php program to find the intersection of two arrays.
Write a php program to search for a specific element in an array.
Write a PHP program to sort an array in ascending and descending order.
Write a php program to remove duplicate elements from an array.
Write a php program to chunk an array into smaller arrays of a specified size.
...