Another Array question...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shoxlx
Forum Newbie
Posts: 23
Joined: Tue Oct 11, 2005 10:42 pm

Another Array question...

Post by shoxlx »

Is there a way to count up all the numbers in an array?

ex :: array('1','2','5','3'); would be counted up to 11
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

You can write a function to do that...

Traverse through the array and add each to the sum of the previous addition.
shoxlx
Forum Newbie
Posts: 23
Joined: Tue Oct 11, 2005 10:42 pm

Post by shoxlx »

ys i know, but i was just wondering if there was a simpler way...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply