patawic Posted February 20, 2010 Share Posted February 20, 2010 if you look here http://xboxgamercard.net/ps3/?psn=derp it will show something similar to this [total trophies] => 204 [bronze trophies] => 169 [silver trophies] => 29 [Gold trophies] => 6 [platinum trophies] => 0 I am needing a more efficient way of adding up all of the trophies, my current method only ads up the first 10 games. Heres my current code for the adding up of the trophies $gamercard['total trophies'] = $total[1][0] + $total[1][5] + $total[1][10] + $total[1][15] + $total[1][20] + $total[1][25] + $total[1][30] + $total[1][35] + $total[1][40] + $total[1][45]; $gamercard['Bronze trophies'] = $total[1][1] + $total[1][6] + $total[1][11] + $total[1][16] + $total[1][21] + $total[1][26] + $total[1][31] + $total[1][36] + $total[1][41] + $total[1][46]; $gamercard['Silver trophies'] = $total[1][2] + $total[1][7] + $total[1][12] + $total[1][17] + $total[1][22] + $total[1][27] + $total[1][32] + $total[1][37] + $total[1][42] + $total[1][47]; $gamercard['Gold trophies'] = $total[1][3] + $total[1][8] + $total[1][13] + $total[1][18] + $total[1][23] + $total[1][28] + $total[1][33] + $total[1][38] + $total[1][43] + $total[1][48]; $gamercard['platinum trophies'] = $total[1][4] + $total[1][9] + $total[1][14] + $total[1][19] + $total[1][24] + $total[1][29] + $total[1][34] + $total[1][39] + $total[1][44] + $total[1][49]; There has to be a formula or something i can use to calculate that with ease. because some people have 100+ recent games played. which need to be added into the trophy counter. Any suggestions to point me in the right direction? Link to comment https://forums.phpfreaks.com/topic/192712-formula-to-help-add-up-psn-trophies/ Share on other sites More sharing options...
sader Posted February 20, 2010 Share Posted February 20, 2010 try this for($i=0; $i<100; $i++) { $gamercard['total trophies'] += $total[1][0 + 5 * $i]; $gamercard['Bronze trophies'] += $total[1][1 + 5 * $i]; $gamercard['Silver trophies'] += $total[1][2 + 5 * $i]; $gamercard['Gold trophies'] += $total[1][3 + 5 * $i]; $gamercard['platinum trophies'] += $total[1][4 + 5 * $i]; } Link to comment https://forums.phpfreaks.com/topic/192712-formula-to-help-add-up-psn-trophies/#findComment-1015189 Share on other sites More sharing options...
patawic Posted February 20, 2010 Author Share Posted February 20, 2010 Thanks works perfectly Link to comment https://forums.phpfreaks.com/topic/192712-formula-to-help-add-up-psn-trophies/#findComment-1015397 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.