PHP unserialize() Function

PHP 可用的函数PHP Available Functions

unserialize()The function is used toserialize() deserialize the object or array serialized by the function, and return the original object structure.

PHP Version Requirement: PHP 4, PHP 5, PHP 7

Syntax

mixed unserialize ( string $str )

Parameter Description:

  • $str: The serialized string.

Return Value

Returns the converted value, which can be integer, float, string, array, or object.

If the passed string cannot be unserialized, it returns FALSE and produces an E_NOTICE.

Example

Example

<?php $str = 'a:3:{i:0;s:6:"Google";i:1;s:6:"Example";i:2;s:8:"Facebook";}'; $unserialized_data = unserialize($str); print_r($unserialized_data); ?>

The output result is:

Array
(
    [0] => Google
    [1] => Example
    [2] => Facebook
)

PHP 可用的函数PHP Available Functions

Other Extensions