View Full Version : Please explain this behavior of unserialize
06-17-2005, 10:56 AM
$foo = unserialize('');
// echoes 1
// echoes nothing
06-17-2005, 04:03 PM
Unserialize is used on arrays that have been serialized.
06-17-2005, 04:07 PM
from the manual on count (http://www.php.net/manual/en/function.count.php):
If var is not an array or an object with implemented Countable interface, 1 will be returned.
and in your example $foo will be set to boolean false, so it cannot be "counted".
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.