Re: Summing array indexes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This should help:
http://us.php.net/array_walk

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Tom Shaw wrote:
> Is there an easy way to loop thru the array below and add the incremented
> total price indexes so the order_total_price index contains the correct sum.
> Any help would be greatly appreciated.
>
>  
>
>  
>
> array(5) {
>
>   [0] => array(15) {
>
>     ["order_date"] => string(8) "09-01-08"
>
>     ["order_product_price_1"] => string(5) "10.00"
>
>     ["order_product_price_2"] => string(5) "20.00"
>
>     ["order_total_price"] => string(0) ""
>
>   }
>
>   [1] => array(19) {
>
>     ["order_date"] => string(8) "09-01-08"
>
>     ["order_product_price_1"] => string(5) "25.00"
>
>     ["order_product_price_2"] => string(5) "15.00"
>
>     ["order_total_price"] => string(0) ""
>
>   }
>
>  
>
> Like this. 
>
>  
>
> array(5) {
>
>   [0] => array(15) {
>
>     ["order_date"] => string(8) "09-01-08"
>
>     ["order_product_price_1"] => string(5) "10.00"
>
>     ["order_product_price_2"] => string(5) "20.00"
>
>     ["order_total_price"] => string(0) "30.00"
>
>   }
>
>   [1] => array(19) {
>
>     ["order_date"] => string(8) "09-01-08"
>
>     ["order_product_price_1"] => string(5) "25.00"
>
>     ["order_product_price_2"] => string(5) "15.00"
>
>     ["order_total_price"] => string(0) "40.00"
>
>   }
>
>  
>
> Tom Shaw
>
>  
>
> php.coder@xxxxxxxxx
>
>  
>
>
>   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux