0) { $pieces = explode(",", $alias_string); $count_item = count($pieces); for ($ii = 0; $ii < $count_item; $ii++) { $this_element = trim(strtolower($pieces[$ii])); if (strlen($this_element) > 0) { $itm_str = "'" . $this_element . "'"; if ($ii > 0) { $alias_extra .= ","; } $alias_extra .= $itm_str; } } } echo $alias_extra;