SplObjectStorage::unserialize

(PHP 5 >= 5.2.2, PHP 7)
Unserializes a storage from its string representation
public void SplObjectStorage::unserialize ( string $serialized )

Unserializes storage entries and attach them to the current storage.

Parameters:
serialized

The serialized representation of a storage.

Returns:

No value is returned.

Examples:
SplObjectStorage::unserialize() example
1
2
3
4
5
6
7
8
9
10
<?php
$s1 new SplObjectStorage;
$s2 new SplObjectStorage;
$o new StdClass;
$s1[$o] = "data";
 
$s2->unserialize($s1->serialize());
 
var_dump(count($s2));
?>

The above example will output something similar to:

int(1)
See also:

SplObjectStorage::serialize() -

doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.