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 :: array_flatten php 
Php :: Remove the Breadcrumbs on the Shop Entirely 
Php :: wc_product_attribute set_options value 
Php :: Reset Admin password in Magento 2 
Php :: remove string after comma in php 
Php :: in_array 
Php :: laravel create resource controller 
Php :: php rsort retain keys 
Php :: php get object class 
Php :: encrypt & decrypt laravel 
Php :: php if in array 
Php :: laravel 8 blade get days and hours ago 
Php :: php convert print_r to array 
Php :: laravel collection isempty 
Php :: laravel invoice number generator 
Php :: laravel dump] 
Php :: php unlink 
Php :: how to clear session in laravel 
Php :: laravel check if item is in collection 
Php :: php match 
Php :: - root composer.json requires php ^7.2 but your php version (8.0.1) does not satisfy that requirement. 
Php :: get only the first two word from a string php 
Php :: type hidden value put laravel 
Php :: diffinhours with minutes carbon 
Php :: php loops 
Php :: how to see php error log 
Php :: laravel override factory values in database seeder 
Php :: laravel loop index 
Php :: php html template if conditions 
Php :: get min value from array php 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =