How do I replace double quotes with single quotes

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


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

or Re-assign it

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

Use

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

Try with preg_replace,

<?php
$string="hello \" sdfsd \" dgf";
echo $string,"\n";
echo preg_replace("/\"/","'",$string);
?>

You can use str_replace, try to use http://php.net/manual/en/function.str-replace.php it contains allot of php documentation.

<?php

echo str_replace("\"","'","\"\"\"\"\" hello world\n");
?>

Try with strtr,

<?php
$string="hello \" sdfsd dgf";
echo $string;
$string = strtr($string, "\"", "'");
echo $string;
?>