Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php sum array elements

<?php
$a=array(5,15,25);
echo array_sum($a);
?>
Comment

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);
?>
Comment

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

?>
Comment

PREVIOUS NEXT
Code Example
Php :: laravel get latest record by date 
Php :: deprcation problem phpmyadmin ubuntu 
Php :: laravel helper function for check string is exist in another string 
Php :: laravel redirect back with input 
Php :: yii2 confirm 
Php :: Laravel Eloquent, group by month/year 
Php :: php extract zip 
Php :: getoriginal laravel 
Php :: laravel increment column value in update query 
Php :: add dd function composer 
Php :: how to add shortcode in html 
Php :: laravel migration add unique column 
Php :: php header redirect same page 
Php :: used resoure route how to add another route 
Php :: Search WordPress with custom field 
Php :: joomla redirect 
Php :: laravel end date greater than start date validation 
Php :: php replace method that takes infinite input 
Php :: get current route laravel 
Php :: php artian migrate table 
Php :: wsl continuous loading 
Php :: get parameter in php 
Php :: cakephp 2 with customize link 
Php :: twig create new array 
Php :: replace all php 
Php :: laravel simplexmlelement xml add attribute 
Php :: wordpress loop 
Php :: file upload in php through ajax 
Php :: php number to word 
Php :: remove all spaces php 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =