PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular

unserialize

Tags: PHP 5.x PHP 7.x PHP 8.x

unserialize — Creates a PHP value from a stored representation.

Description

unserialize(
    string $data,
array $options = []
): mixed
unserialize() takes a single serialized variable and converts it back into a PHP value.

Parameters

data
The serialized string. If the variable being unserialized is an object, after successfully reconstructing the object PHP will automatically attempt to call the __unserialize() or __wakeup() methods (if one exists).
options
Any options to be provided to unserialize(), as an associative array.

Return Values

The converted value is returned, and can be a bool, int, float, string, array or object. In case the passed string is not unserializeable, false is returned and E_NOTICE is issued.

unserialize - New snippets