sum of the array elements in php
Return the sum of all the values in the array (5+15+25):
<?php
$a=array(5,15,25);
echo array_sum($a);
?>
sum of the array elements in php
Return the sum of all the values in the array (5+15+25):
<?php
$a=array(5,15,25);
echo array_sum($a);
?>
add two numbers in php
<?php
$x=15;
$y=30;
$z=$x+$y;
echo "Sum: ",$z;
?>
PHP array sum
<?php
$indexedArray = Array(20, 20, 5.5, "str");
$associativeArray = Array(
1 => 20,
2 => 20,
3 => 5.5,
4 => "str"
);
echo array_sum($indexedArray) . "<br>"; // 45.5
echo array_sum($associativeArray); // 45.5
?>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us