Skip to content

Instantly share code, notes, and snippets.

@low
Created February 17, 2010 17:48
Show Gist options
  • Save low/306849 to your computer and use it in GitHub Desktop.
Save low/306849 to your computer and use it in GitHub Desktop.
// To serialize:
// Yeah, that's 3, 1, 3 and 11 backslashes.
preg_replace('/\\\("|\'|\\\)/', '\\\\\\\\\\\$1', serialize($array));
// To unserialize:
$REGX->array_stripslashes(unserialize($string));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment