What about
<?php $arr = spliti(",","alpha,beta,charlie"); for($i=0; $i < sizeof($arr); $i++) $var = $var . '"' . $arr[$i] . '",'; //to avoid comma at the end $var = substr($var, 0,-1); echo $var; ?>
with function:
<?php function AddQuotes($str){ $arr = spliti(",",$str); for($i=0; $i < sizeof($arr); $i++) $var = $var . '"' . $arr[$i] . '",';
source share