array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'splobjectstorage.detach.php', 1 => 'SplObjectStorage::detach', ), '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', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplObjectStorage::detach — Removes an object from the storage
没有返回值。
示例 #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)