Can someone please tell me how to count the number of values in a comma delimited string. I tried this below but it says the value is 1 when it should be 3.
$colors = "red,blue,yellow"; $numOpts = count($colors);
$echo numOpts;
$colors = "red,blue,yellow"; $numOpts = count(explode(",",$colors));
echo $numOpts;
explode splits $colors into an array, then count counts the elements of the array