Home > Backend Development > PHP Tutorial > How to use unserialize in PHP

How to use unserialize in PHP

coldplay.xixi
Release: 2023-04-08 20:20:01
forward
3868 people have browsed it

How to use unserialize in PHP

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);
Copy after login

Output:

Array
(
    [liqingbo] => 李清波
    [zhangxueyou] => 张学友
    [guofucheng] => 郭富城
)
Copy after login

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!

Related labels:
source:liqingbo.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template