Hi, can someone give me the code to find and replace in php?
I want to find \" and replace it by " but I don't know how to do this, can anyone help me ?
thx
Peter
find and replace
Moderators: egami, macek, gesf
simply use str_replace:
pay close attention to the use of '
Greetz Daan
Code: Select all
$new_value = str_replace('\"','"',$original_value);
pay close attention to the use of '
Greetz Daan
damn I thought this would fix my problem but it doesn't, let me explain you what I'm trying to do:
I'm trying to create a script that can change the html code of a page, it worked well axcept for one problem, it always puts quotes " or ' like \" or \' if I want to change the code through this function : fwrite($file_pointer, $input); the $input is submitted from another page and so every " or ' this $input contains he outputs like \" \' because he fills in the $input by "text of input" I guess, does anybody has an idea how to change this because pages that contain scriptfunction or where I do a <body bgcolor="red"> don't work ...
thx
scribeke
p.s. DoppyNL -> from netherlands or belgium ?
I'm trying to create a script that can change the html code of a page, it worked well axcept for one problem, it always puts quotes " or ' like \" or \' if I want to change the code through this function : fwrite($file_pointer, $input); the $input is submitted from another page and so every " or ' this $input contains he outputs like \" \' because he fills in the $input by "text of input" I guess, does anybody has an idea how to change this because pages that contain scriptfunction or where I do a <body bgcolor="red"> don't work ...
thx
scribeke
p.s. DoppyNL -> from netherlands or belgium ?
try the function stripslashes -> see http://www.php.net/stripslashes
Just look at my profile to see wich wet country it is
Greetz Daan
Just look at my profile to see wich wet country it is

Greetz Daan