Posted on 2003-10-26
I've got 2 variables named $one and $two.
$one contains a whole sentence, for example:
$one="The cat is never far from home";
$two contains some characters, for example:
$two="The e o";
Now I want to count the occurences of each character/word of $two in $one.
'The' should give as result 1, because the word The occures one time in $one
'e' should give as result 3, because the character 'e' occures three times in $one
'o' should give a result 2, because the character 'o' occures two times in $one
Which lines do I need for this ?