moses toh moses toh - 4 months ago 15
PHP Question

How to add single quotes in string php?

I have

$a = 6,9,13,1


I want to change to
$a = '6','9','13','1'


Any solution to solve my problem?

Answer

If $a is a string and you want to change numbers that way, you can use this code:

$a = preg_replace("/\d+/", "'$0'", $a);