PHP Doku:: Removes objects contained in another storage from the current storage - splobjectstorage.removeall.html

Verlauf / Chronik / History: (8) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige GrunderweiterungenStandard PHP Library (SPL)DatenstrukturenThe SplObjectStorage classSplObjectStorage::removeAll

Ein Service von Reinhard Neidl - Webprogrammierung.

The SplObjectStorage class

<<SplObjectStorage::offsetUnset

SplObjectStorage::removeAllExcept>>

SplObjectStorage::removeAll

(PHP 5 >= 5.3.0)

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

Beschreibung

public void SplObjectStorage::removeAll ( SplObjectStorage $storage )

Removes objects contained in another storage from the current storage.

Parameter-Liste

storage

The storage containing the elements to remove.

Rückgabewerte

Es wird kein Wert zurückgegeben.

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


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)