Monkuar Posted December 15, 2011 Share Posted December 15, 2011 Hey, I am echoing out: $source = implode(',', $arr2); echo $source; which is a array, and it echo's out: "2,2,2" I am trying to find a php function to add each array, so the result will be "6". Possible? Link to comment https://forums.phpfreaks.com/topic/253270-adding-a-implode-value-into-1-integer/ Share on other sites More sharing options...
Monkuar Posted December 15, 2011 Author Share Posted December 15, 2011 WOW count function i am a idiot, Topic resolved ty Link to comment https://forums.phpfreaks.com/topic/253270-adding-a-implode-value-into-1-integer/#findComment-1298326 Share on other sites More sharing options...
MasterACE14 Posted December 15, 2011 Share Posted December 15, 2011 array_sum() echo array_sum($source); // 6 Link to comment https://forums.phpfreaks.com/topic/253270-adding-a-implode-value-into-1-integer/#findComment-1298327 Share on other sites More sharing options...
scootstah Posted December 15, 2011 Share Posted December 15, 2011 WOW count function i am a idiot, Topic resolved ty No, count will count the number of elements inside an array. What you want is array_sum() like MasterACE14 said. Link to comment https://forums.phpfreaks.com/topic/253270-adding-a-implode-value-into-1-integer/#findComment-1298329 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.