[Solved] How to split and count the words with single quotes (‘)?


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

3

solved How to split and count the words with single quotes (‘)?