Ok! I have this script but I'm puzzled! .. I assigned each letter (a, b ,c ...etc.) to a number .. so whenever I write a word (cake) it should write the numbers .. but how do I make it use the "+" function to give me the total result?
here is a slice of the code ::
<?PHP
include("header.inc")
?>
<?
for ($x = 0; $x < strlen($userString); $x++)
{
$thischar = substr($userString, $x, 1,);
if ($thischar == "a)
{echo ("1);}
else
if ($thischar == "b)
{echo ("2);}
else
print ("(ERROR)");
}
then it prints the resulted numbers in a textarea field...
How can I make the script do the function "+" to a & b so that ab=3 as assigned in the script?
Thank you!