salukigirl
New Member
- Messages
- 78
- Reaction score
- 0
- Points
- 0
I'm making a game and the animals have randomized stats, 4 of them. I want those to be added together for a "total" and then have the total displayed but how do I do that?
Last edited:
assuming you get the stats from a database:-
PHP://looping through the database on $k: { $total[$k]=$stat0[$k]+$stat1[$k]+$stat2[$k]+$stat3[$k]; //} echo sort($total,SORT_NUMERIC); //sort the totals
<?php
foreach ($total as $key => $val) {
echo "total[" . $key . "] = " . $val . "\n";
}
?>