The ArrayObject::unserialize() function is an inbuilt function in PHP which is used to unserializes the serialized ArrayObject.
Syntax:
void ArrayObject::unserialize( string $serialized )
Parameters: This function accepts single parameter $serialized which holds the serialized ArrayObject.
Return Value: This function returns the unserialized ArrayObject.
Below program illustrates the ArrayObject::unserialize() function in PHP:
Program:
<?php
$arr = array (
"a" => "Welcome" ,
"b" => "to" ,
"c" => "GeeksforGeeks"
);
$arrObject = new ArrayObject( $arr );
$serialize1 = serialize( $arrObject );
$serialize2 = unserialize( $serialize1 );
var_dump( $serialize1 );
var_dump( $serialize2 );
?>
|
Output:
string(113) "C:11:"ArrayObject":89:{
x:i:0;a:3:{
s:1:"a";s:7:"Welcome";
s:1:"b";s:2:"to";
s:1:"c";s:13:"GeeksforGeeks";
}
;m:a:0:{}
}"
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(3) {
["a"]=>
string(7) "Welcome"
["b"]=>
string(2) "to"
["c"]=>
string(13) "GeeksforGeeks"
}
}
Reference: https://www.php.net/manual/en/arrayobject.unserialize.php
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
27 Sep, 2019
Like Article
Save Article