Page 1 of 1

finding sum of the array

Posted: Sat Nov 14, 2009 2:22 pm
by nevx009
$prices=array("Brand New Computer"=>2000,"pencil"=>25,"Learning PHP"=>"60");

foreach($prices as $key=>$value) {

}

finding sum of the array e.g say we wanted to to see the price of the 2000 + 25+60 , can we have sum total of the $value ?what if we had a bigger list in the array
ant hlp appreciated

thks

Re: finding sum of the array

Posted: Sat Nov 14, 2009 2:36 pm
by jackpf
array_sum().

:)