note 104619 deleted from function.unserialize by danbrown

From: Date: Mon, 27 Jun 2011 14:31:45 +0000
Subject: note 104619 deleted from function.unserialize by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-180992@lists.php.net to get a copy of this message
Note Submitter: kamil dot kuzminski at gmail dot com ---- If you are having troubles unserializing the string which contains dollars and single quotes, you can use this code: <?php $strParams = str_replace('$', '~', $strSerialized); $strParams = preg_replace('!s:(\d+):"(.*?)";!se', '"s:".strlen("$2").":\"$2\";"', $strParams); $strParams = str_replace('~', '$', $strParams); ?> Here is example array I had to deal with. It contains a list of parameters of a particular function: Array ( [0] => Array ( [type] => integer [name] => $varId ) [1] => Array ( [type] => boolean [name] => $blnMultiMode=false ) [2] => Array ( [type] => boolean [name] => $blnIsInsertTag=false ) [3] => Array ( [type] => string [name] => $strColumn='main' ) ) Thanks for "chris at r3i dot it" below!

« previous php.notes (#180992) next »