note 60584 added to function.unserialize
| From: | artistan at cableone dot net | Date: | Wed, 11 Jan 2006 16:46:42 +0000 |
| Subject: | note 60584 added to function.unserialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-101573@lists.php.net to get a copy of this message | ||
// thanks to user comments I created this
/**
UnSerialize and return data
@param string [$serialized_data] data to unserialize
@return mixed
*/
function unserialize_data($serialized_data,$objects=true){
if($objects){
// thanks to comment from veg@rd.no 04-Jan-2006 10:34 at http://us2.php.net/manual/en/function.unserialize.php
// make classes for those that do not exist
$matches = Array();
preg_match_all('/O:(\d)*:"([^":]*)":/', $text, $matches);
foreach ($matches[2] as $class)
{
if(!class_exists($class))
eval('class '.$class.' { }');
}
}
return unserialize($serialized_data);
}
// if using php5 you may want to modify to use __autoload function.
----
Manual Page -- http://www.php.net/manual/en/function.unserialize.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60584
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60584&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60584&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60584&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60584&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60584&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60584&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60584&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60584&report=yes
Search -- http://master.php.net/manage/user-notes.php