Reputation: 13
I have a series of strings that I have read in with fgets() from a .csv file, and then exploded into an array. The file has the csv standard double quotes. For example:
<a href=""http://www.youtube.com/watch?v=HqaemO-lI8s#t=16m6s"" target=_blank"">video</a>
is one of the values that I am reading in. I need all instances of "" to be replaced by just ". I know that this is a simple solution, but I can't seem to wrap my head around the way that the escape characters would work.
Upvotes: 1
Views: 1165
Reputation: 9302
Use str_replace:
$string = '<a href="""">test</a>';
$string = str_replace('""', '"', $string);
echo $string;
// Outputs: <a href="">test</a>
Upvotes: 7