PHP Unserialize: Convert String to Data Structure
The unserialize function is used to convert a serialized string back into a PHP data structure. Its syntax is as follows:
mixed unserialize ( string $str )
Here, str is a serialized string. Unserialize converts this string back into the original PHP value.
For example,
$data = 'a:2:{s:4:"name";s:5:"Alice";s:3:"age";i:25;}';
$array = unserialize($data);
print_r($array);
The above code will output:
Array
(
[name] => Alice
[age] => 25
)