在线文档教程
PHP
SPL

SplObjectStorage::unserialize

SplObjectStorage::unserialize

(PHP 5 >= 5.2.2, PHP 7)

SplObjectStorage::unserialize — Unserializes a storage from its string representation

Description

public void SplObjectStorage::unserialize ( string $serialized )

Unserializes storage entries and attach them to the current storage.

Parameters

serialized

The serialized representation of a storage.

Return Values

No value is returned.

Examples

Example #1 SplObjectStorage::unserialize() example

<?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() - Serializes the storage

← SplObjectStorage::setInfo

SplObjectStorage::valid →

© 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

https://secure.php.net/manual/en/splobjectstorage.unserialize.php