1

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?

Anton
  • 1,029
  • 7
  • 19
  • If you modify serialized string you won't be able to deserialize one because it will be broken. Less painful will be if you deserialize array, modify its elements as you want and then serialize it again. – Leri Aug 20 '12 at 12:06
  • Yah, i know it, so i need to modify it back :) and this will help me to do it. – Anton Aug 20 '12 at 12:07

1 Answers1

3

Try

preg_replace("/([^:])(\")([^;:])+/isU","$1"$3",$arr);
Touki
  • 7,465
  • 3
  • 41
  • 63