I want to split word like who's and count it into 2 words like:
who = 1
s = 1
I think, it will use preg_split to do this job, but i don't understand how to do it.
Please any help
Thanks
I want to split word like who's and count it into 2 words like:
who = 1
s = 1
I think, it will use preg_split to do this job, but i don't understand how to do it.
Please any help
Thanks
You may use explode() to get it.
$word= "who's'who";
$results= array();
$parts = explode ("'", $word);
foreach ($parts as $part) $results[$part]++;
You then may output like:
foreach ($results as $word => $count) echo $word . " = " . $count. "<br>";
The output should be:
who = 2
s = 1