Username: Posted March 11, 2011 Share Posted March 11, 2011 I have these numbers in an array: 14042 11130 10100 10100 9506 How can I add them all together? Was thinking about a while loop. Derp. >array_sum solved! Link to comment https://forums.phpfreaks.com/topic/230382-php-add-each-number-in-an-array-together/ Share on other sites More sharing options...
silkfire Posted March 11, 2011 Share Posted March 11, 2011 No need: $sum = array_sum($array); Link to comment https://forums.phpfreaks.com/topic/230382-php-add-each-number-in-an-array-together/#findComment-1186450 Share on other sites More sharing options...
Username: Posted March 11, 2011 Author Share Posted March 11, 2011 No need: $sum = array_sum($array); Just as I decided to actually search my problem I found the solution as you posted. Weird. Thanks anyways EDIT: What happened to my solved button ._. Link to comment https://forums.phpfreaks.com/topic/230382-php-add-each-number-in-an-array-together/#findComment-1186451 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.