tags:

views:

321

answers:

5

Hy everyone how can I replace "" // i think its called double quotes with '' // i think its called single quotes using PHP ?

+10  A: 
str_replace('"',"'",$text);
S.Mark
Thanks this worked for me;
streetparade
+4  A: 

Use

$str = str_replace('"','\'',$str)
codaddict
+3  A: 

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");
?>
Nick Hermans
+1  A: 

Try with strtr,

<?php
$string="hello \" sdfsd dgf";
echo $string;
$string = strtr($string, "\"", "'");
echo $string;
?>
karthi_ms
+3  A: 

Try with preg_replace,

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