Jump to content

I have a problem with str_replace. Plz help


bimbofred

Recommended Posts

Hi,

 

I have created a form. I made it so that when someone submits " or ' insted of echoing like this \" or \' it echos like this " or '.

The code I used was this:

$find = array("\"","\'");
$replace = array('"',"'");
$write = str_replace($find, $replace, $_GET["text"]);
echo $write;

 

The problem is it echos this \ insted of this " and this " insted of this '.

Why?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.