In PHP, the serialize() function is used to serialize objects or arrays and returns a string containing a byte stream representing them.
PHP Unserialize is the reverse process of serialization, i.e., converting a byte stream back into an object.
Using our provided PHP Unserialize online tool, you can test serialized strings before serialization, or click 'PHP Online Compiler' to perform testing.
You can click the "Example" button to learn how to use it.
We provide the following example to demonstrate how to use PHP Unserialize.
<?php
$ser = 'a:3:{s:2:"id";i:1;s:4:"name";s:4:"John";s:3:"age";i:32;}';
$ser = unserialize($ser);
var_dump($ser);
?>
Output:
array(3) {
["id"]=>
int(1)
["name"]=>
string(4) "John"
["age"]=>
int(32)
}