I have a comma separated value like
alpha,beta,charlie
how can i convert it to
"alpha","beta","charlie"
using a single funcion of php without using str_replace?
Alternatively to Richard Parnaby-King's function (shorter):
function addQuotes($string) {
return '"'. implode('","', explode(',', $string)) .'"';
}
echo addQuotes('alpha,beta,charlie'); // = "alpha","beta","charlie"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With