(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplObjectStorage::detach — Removes an object from the storage
Diese Funktion ist seit PHP 8.5.0 als DEPRECATED (veraltet) markiert. Von der Verwendung dieser Funktion wird dringend abgeraten.
since: '8.5',message: "use method SplObjectStorage::offsetUnset() instead",$object): voidRemoves the object from the storage.
Es wird kein Wert zurückgegeben.
| Version | Beschreibung |
|---|---|
| 8.5.0 | This method has been deprecated in favor of SplObjectStorage::offsetUnset(). |
Beispiel #1 SplObjectStorage::detach() example
<?php
$o = new stdClass;
$s = new SplObjectStorage();
$s->attach($o);
var_dump(count($s));
$s->detach($o);
var_dump(count($s));
?>Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
int(1) int(0)