- array_count_values: documentation ( source)
- str_split: documentation ( source)
<?php
$uniqueCount = 0;
foreach (array_count_values(str_split('abclkjabc')) as $char => $count) {
if ($count === 1) {
++$uniqueCount;
}
}
echo $uniqueCount;