PHP SplObjectStorage unserialize() Function Last Updated : 23 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The SplObjectStorage::unserialize() function is an inbuilt function in PHP which is used to unserialize the storage from its serialize string representation. Syntax: void SplObjectStorage::unserialize( $serilize ) Parameters: This function accepts a single parameter $serialize which specifies the string serialization of the storage. Return Value: This function does not return any value. Below programs illustrate the SplObjectStorage::unserialize() function in PHP: Program 1: php <?php $obj1 = new StdClass; // Create an empty SplObjectStorage $gfg1 = new SplObjectStorage(); $gfg1[$obj1] = "Geeks"; // Use unserialize() function $gfg1->unserialize($gfg1->serialize()); print_r($gfg1); ?> Output: SplObjectStorage Object ( [storage:SplObjectStorage:private] => Array ( [00000000494fcd4d000000001f544823] => Array ( [obj] => stdClass Object ( ) [inf] => Geeks ) [00000000494fcd4f000000001f544823] => Array ( [obj] => stdClass Object ( ) [inf] => Geeks ) ) ) Program 2: php <?php $obj1 = new StdClass; $obj2 = new StdClass; // Create an empty SplObjectStorage $gfg1 = new SplObjectStorage(); $gfg1[$obj1] = "Geeks"; // Create an empty SplObjectStorage $gfg2 = new SplObjectStorage(); $gfg2[$obj1] = "GFG"; $gfg2[$obj2] = "GeeksClasses"; // Use unserialize() function $gfg1->unserialize($gfg2->serialize()); var_dump(count($gfg1)); // Use unserialize() function $gfg2->unserialize($gfg1->serialize()); var_dump(count($gfg2)); ?> Output: int(3) int(5) Reference: https://www.php.net/manual/en/splobjectstorage.unserialize.php Comment More infoAdvertise with us Next Article PHP SplObjectStorage unserialize() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP SplObjectStorage valid() Function The SplObjectStorage::valid() function is an inbuilt function in PHP which is used to check the current storage entry is valid or not. Syntax: bool SplObjectStorage::valid() Parameters: This function does not accept any parameter. Return Value: This function returns true if the iterator entry is val 1 min read PHP | SplDoublyLinkedList unserialize() Function The SplDoublyLinkedList::unserialize() function is an inbuilt function in PHP which is used to unserialize the storage of SplDoublyLinkedList::serialize() function. Syntax: void SplDoublyLinkedList::unserialize( string $serialized ) Parameters: This function accepts single parameter $serialized whic 2 min read PHP SplObjectStorage key() Function The SplObjectStorage::key() function is an inbuilt function in PHP which is used to get the index of the currently pointing iterator. Syntax: int SplObjectStorage::key() Parameters: This function does not accept any parameter. Return Value: This function returns the index at which the iterator curre 1 min read PHP SplObjectStorage next() Function The SplObjectStorage::next() function is an inbuilt function in PHP which is used to move to next entry of storage. Syntax: void SplObjectStorage::next() Parameters: This function does not accept any parameter. Return Value: This function does not return any value. Below programs illustrate the SplO 1 min read PHP SplObjectStorage count() Function The SplObjectStorage::count() function is an inbuilt function in PHP which is used to count the number of objects in storage. Syntax: int SplObjectStorage::count() Parameters: This function does not contains any parameter. Return Value: This function returns number of objects in storage. Below progr 1 min read Like