When I implode my array I get a list that looks like this:
qwerty, QTPQ, FRQO
I need to add single quotes so it looks like:
'qwerty', 'QTPQ', 'FRQO'
Can this be done using PHP?
$str = implode("', '", $arr); gives you the elements separated by ', ' . From there all you need to do is concatenate your list with single quotes on either end.
Use '
before and after implode()
$temp = array("abc","xyz"); $result = "'" . implode ( "', '", $temp ) . "'"; echo $result; // 'abc', 'xyz'
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