note 105873 deleted from function.is-object by danbrown
| From: | danbrown@php.net | Date: | Wed, 21 Sep 2011 19:35:02 +0000 |
| Subject: | note 105873 deleted from function.is-object by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183339@lists.php.net to get a copy of this message | ||
Note Submitter: mark at not4you dot com
----
<?php
/**
* Unserializes data as returned by the standard PHP serialize() function.
* If the unserialized object is not an array, it will be converted to one,
* particularily useful if it returns a __PHP_Incomplete_Class.
*
* @param string $data Serialized data
*
* @return array Unserialized array
*/
function unserialize2array($data) {
$obj = unserialize($data);
if(is_array($obj)) return $obj;
$arr = array();
foreach($obj as $k=>$v) {
$arr[$k] = $v;
}
unset($arr['__PHP_Incomplete_Class_Name']);
return $arr;
}