$text = "hi,my,name,is,shooki"; $charcheck = explode(",", $text); for ($i=1; $i<count($charcheck); $i++) { $b++; } echo $b;