Easy Tutorial
❮ Func Misc Exit Func Date Timestamp Set ❯

PHP unserialize() Function

PHP Available Functions

The unserialize() function is used to convert an object or array that has been serialized by the serialize() function back into its original structure.

PHP Version Requirements: PHP 4, PHP 5, PHP 7

Syntax

mixed unserialize ( string $str )

Parameter Description:

Return Value

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

If the passed string is not unserializable, it returns FALSE and generates an E_NOTICE.

Example

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

Output:

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

PHP Available Functions

❮ Func Misc Exit Func Date Timestamp Set ❯