If you already have the values from an array (these are separated by commas and output as a string) and you want to use them as a counter.
$variable = (your string from an array);
echo $variable; => is output as an example with the values (one, two, three, four, five).
Now you need a counter that shows the number of values as a counter, i.e. (5).
$count_string = explode(",",$variable);
foreach($count_string as $string) $return_string[$string]++;
foreach($return_string as $return_single => $single_string)
$counter += ($single_string); // Adding together the individual values.
echo $counter; // Here the result is shown as 5.