unserialize
Operations on a single serialized variable, converting it back to a PHP value.
The value returned is the converted value, which can be integer, float, string, array or object.
If the passed string is not deserializable, FALSE is returned and an E_NOTICE is generated.
Example 1:
$str = 'a:3:{s:8:"liqingbo";s:9:"李清波";s:11:"zhangxueyou";s:9:"张学友";s:10:"guofucheng";s:9:"郭富城";}'; $arr = unserialize($str); print_r($arr);
Output:
Array ( [liqingbo] => 李清波 [zhangxueyou] => 张学友 [guofucheng] => 郭富城 )
Recommended tutorial: "PHP Video Tutorial"
The above is the detailed content of How to use unserialize in PHP. For more information, please follow other related articles on the PHP Chinese website!