\n"; echo "CountTermEnglishGerman"; $i = 1; $countWords = 0; foreach ($missingTerms as $key => $term) { if (isset($referenceTerms[$term])) { $trimmed = trim($referenceTerms[$term],';" '); $countWords += str_word_count($trimmed); echo "$i$term".$trimmed."\n"; } $i++; } echo "\n"; echo "Total words to be translated: ".$countWords.PHP_EOL;