array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'splobjectstorage.addall.php', 1 => 'SplObjectStorage::addAll', ), 'up' => array ( 0 => 'class.splobjectstorage.php', 1 => 'SplObjectStorage', ), 'prev' => array ( 0 => 'class.splobjectstorage.php', 1 => 'SplObjectStorage', ), 'next' => array ( 0 => 'splobjectstorage.attach.php', 1 => 'SplObjectStorage::attach', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/spl/splobjectstorage/addall.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplObjectStorage::addAll — Adds all objects from another storage
Adds all objects-data pairs from a different storage in the current storage.
storage
The storage you want to import.
The number of objects in the storage.
示例 #1 SplObjectStorage::addAll() example
<?php
$o = new stdClass;
$a = new SplObjectStorage();
$a[$o] = "hello";
$b = new SplObjectStorage();
$b->addAll($a);
echo $b[$o]."\n";
?>
以上示例的输出类似于:
hello