How do I replace double quotes with single quotes


Question

How can I replace "" (I think it's called double quotes) with '' (I think its called single quotes) using PHP?

1
31
10/25/2016 3:09:50 PM

Accepted Answer

str_replace('"', "'", $text);

or Re-assign it

$text = str_replace('"', "'", $text);
83
9/13/2016 11:38:25 AM

Use

$str = str_replace('"','\'',$str)

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon