Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php sum array key

$names=array(
	array("name"=>"taylor","age"=>35),
 	array("name"=>"susan","age"=>30),
);
array_sum(array_column($names, 'age')); //65
Comment

PHP sum array values by key

$sumArray = array();

foreach ($myArray as $k=>$subArray) {
  foreach ($subArray as $id=>$value) {
    $sumArray[$id]+=$value;
  }
}

print_r($sumArray);
Comment

PREVIOUS NEXT
Code Example
Php :: date_default_timezone_set india 
Php :: download php7.4-mbstring ubuntu 
Php :: php iterate folder 
Php :: how to traverse characters in a string in a for loop in php 
Php :: delete folder laravel 
Php :: disable admin bar wordpress 
Php :: composer update without dependencies 
Php :: string contains string laravel 
Php :: laravel get random number of data from database 
Php :: php delay 
Php :: php 3 months ago 
Php :: how to get previous page name in php 
Php :: laravel hash check password, Verifying That A Password Matches A Hash 
Php :: string contains php 
Php :: trim comma from variable in php 
Php :: formate date using carbon in laravel blade 
Php :: php calculate date difference 
Php :: page load time in php 
Php :: wp_query post per page 
Php :: get taxonomy name in singhle post 
Php :: get php memory limit command line 
Php :: larael drop foreign key 
Php :: Download a file from external server using PHP - Move one project to another server 
Php :: cast array to object php 
Php :: php get ip address 
Php :: laravel getbindings 
Php :: php get all txt files in directory 
Php :: composer remove cache 
Php :: how to get javascript variable value in php 
Php :: php word wrap 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =