English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP unserialize() function usage and example

PHP available functions

unserialize() Function used to serialize() Function to deserialize serialized objects or arrays 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

The returned value is the converted value, which can be integer, float, string, array, or object.

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

Online Example

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

The output is:

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

PHP available functions