View Single Post
Old 10-15-2005, 02:13 PM  
mrthumbs
salad tossing sig guy
 
mrthumbs's Avatar
 
Join Date: Apr 2002
Location: mrthumbs*gmail.com
Posts: 11,702
php wizards i have a question

Imagine i have and object with 50 values:

$my_obect->value_1
$my_obect->value_2
$my_obect->value_3
etc etc..

I want to add all values:
$total = $my_object->value_1 + $my_object->value_2 etc etc..

Is there a faster way to do it?

Replacing the number for a var ($my_object->value_$i or {$i} etc) in a while loop doesnt work as it would with normal vars..
mrthumbs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote