= 5.2.2, PHP 7, PHP 8)SplObjectStorage::unserialize — Unserializes a storage from its string representation說明publ">

SplObjectStorage::unserialize

(PHP 5 >= 5.2.2, PHP 7, PHP 8)

SplObjectStorage::unserializeUnserializes a storage from its string representation

說明

public SplObjectStorage::unserialize(string $data): void

Unserializes storage entries and attach them to the current storage.

參數(shù)

data

The serialized representation of a storage.

返回值

沒有返回值。

范例

示例 #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));
?>

以上例程的輸出類似于:

int(1)

參見