CakeFest 2024: The Official CakePHP Conference

SplObjectStorage::addAll

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

SplObjectStorage::addAll別のストレージからすべてのオブジェクトを追加する

説明

public SplObjectStorage::addAll(SplObjectStorage $storage): int

別のストレージにあるすべてのオブジェクトとデータのペアを、 現在のストレージに追加します。

パラメータ

storage

インポートしたいストレージ。

戻り値

ストレージにあるオブジェクトの数を返します。

例1 SplObjectStorage::addAll() の例

<?php
$o
= new stdClass;
$a = new SplObjectStorage();
$a[$o] = "hello";

$b = new SplObjectStorage();
$b->addAll($a);
echo
$b[$o]."\n";
?>

上の例の出力は、 たとえば以下のようになります。

hello

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top