Skip to content

Instantly share code, notes, and snippets.

@Jeemusu
Created February 25, 2014 01:13
Show Gist options
  • Save Jeemusu/9200688 to your computer and use it in GitHub Desktop.
Save Jeemusu/9200688 to your computer and use it in GitHub Desktop.
Mulit-byte Unserialize
/**
* Mulit-byte Unserialize
*
* Recalculates the length of a multibyte strings and unserializes.
* Source: http://dzone.com/snippets/mulit-byte-unserialize
*
* @param string
* @return string
*/
function mb_unserialize($string) {
$string = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $string);
return unserialize($string);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment