I think this might be an easy question for the professionals out there, but here goes.
Basically I want to get the total word count of a bunch of paragraphs. Right now I can get the word count of each paragraph, but I can't figure out how to add them all up.
$para // an array of paragraph strings
$totalcount = '';
foreach ($para as $p)
{
$count = str_word_count($p, 0);
echo $count . "<br />";
}
print_r($totalcount);
this prints a list of 41 numbers, representing the word count of each pagraphs
but the $totalcount is an array of all these numbers. How can I get the sum of all 41 paragraphs?