Replacing specified double quotes in text with pre

2019-02-28 10:04发布

问题:

I have got a serialized array, and I need to replace double quotes in all places like this:

...s:30:"test "is" & test";...

to

...s:30:"test "is" & test";...

There can be a lot of quotes in the text, so can somebody help with it?

回答1:

Try

preg_replace("/([^:])(\")([^;:])+/isU","$1"$3",$arr);