array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'splobjectstorage.removeall.php', 1 => 'SplObjectStorage::removeAll', 2 => 'Removes objects contained in another storage from the current storage', ), 'up' => array ( 0 => 'class.splobjectstorage.php', 1 => 'SplObjectStorage', ), 'prev' => array ( 0 => 'splobjectstorage.offsetunset.php', 1 => 'SplObjectStorage::offsetUnset', ), 'next' => array ( 0 => 'splobjectstorage.removeallexcept.php', 1 => 'SplObjectStorage::removeAllExcept', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/spl/splobjectstorage/removeall.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

SplObjectStorage::removeAll

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

SplObjectStorage::removeAllRemoves objects contained in another storage from the current storage

Beschreibung

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

Removes objects contained in another storage from the current storage.

Parameter-Liste

storage

The storage containing the elements to remove.

Rückgabewerte

Returns the number of remaining objects.

Beispiele

Beispiel #1 SplObjectStorage::removeAll() example

<?php
$o1
= new stdClass;
$o2 = new stdClass;
$a = new SplObjectStorage();
$a[$o1] = "foo";

$b = new SplObjectStorage();
$b[$o1] = "bar";
$b[$o2] = "gee";

var_dump(count($b));
$b->removeAll($a);
var_dump(count($b));
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

int(2)
int(1)

Siehe auch