note 93649 modified in function.unserialize by danbrown
| From: | danbrown@php.net | Date: | Mon, 21 Sep 2009 14:10:18 +0000 |
| Subject: | note 93649 modified in function.unserialize by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160890@lists.php.net to get a copy of this message | ||
I've been having horrendous problems getting my saved to mysql serialized data to unserialize.
All I got back was false.
However, one handy tip saved the day.
<?php
//to safely serialize
$safe_string_to_store = base64_encode(serialize($multidimensional_array));
//to unserialize...
$array_restored_from_db = unserialize(base64_decode($encoded_serialized_string));
?>
--was--
I've been having horrendous problems getting my saved to mysql serialized data to unserialize.
All I got back was false.
However, one handy tip saved the day.
//to safely serialize
$safe_string_to_store = base64_encode(serialize($multidimensional_array));
//to unserialize...
$array_restored_from_db = unserialize(base64_decode($encoded_serialized_string));
http://davidwalsh.name/php-serialize-unserialize-issues
http://php.net/manual/en/function.unserialize.php