Changing output -- Sum of letters in a string PHP
<p>I have this code which calculates the sum of “letter numbers” in a string?. But it gives output like this int(64). 64 is the total of T(20), E(2), S(19), T(20)--> 20+5+19+20=64. </p>

<p>But i want only number as output. 64 instead of int(64) Here is the code</p>

<pre><code>$data = "test";
$testResult = array_values(array_merge(array_fill_keys(range('A','Z'),
                                                   0
                                                  ),
                                   array_count_values(str_split(strtoupper($data)
                                                               )
                                                     )
                                  )
                      );
$wordCount = 0;
foreach($testResult as $letterValue =&gt; $letterCount) {
$wordCount += ++$letterValue * $letterCount;
}

var_dump($wordCount);
</code></pre>

<p>echo $wordcount won't give an output. It shows nothing.</p>

<p>Thanks</p>
