moses toh moses toh - 8 months ago 44
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?


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

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