array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'splobjectstorage.detach.php', 1 => 'SplObjectStorage::detach', 2 => 'Removes an object from the storage', ), 'up' => array ( 0 => 'class.splobjectstorage.php', 1 => 'SplObjectStorage', ), 'prev' => array ( 0 => 'splobjectstorage.current.php', 1 => 'SplObjectStorage::current', ), 'next' => array ( 0 => 'splobjectstorage.gethash.php', 1 => 'SplObjectStorage::getHash', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/spl/splobjectstorage/detach.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

SplObjectStorage::detach

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

SplObjectStorage::detachRemoves an object from the storage

Увага

This function has been DEPRECATED as of PHP 8.5.0. Relying on this function is highly discouraged.

Опис

#[\Deprecated]
public function SplObjectStorage::detach(object $object): void

Removes the object from the storage.

Параметри

object

The object to remove.

Значення, що повертаються

Не повертає значень.

Журнал змін

Версія Опис
8.5.0 This method has been deprecated in favor of SplObjectStorage::offsetUnset().

Приклади

Приклад #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));
?>

Поданий вище приклад виведе щось схоже на:

int(1)
int(0)

Прогляньте також