array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'arrayobject.offsetunset.php', 1 => 'ArrayObject::offsetUnset', ), 'up' => array ( 0 => 'class.arrayobject.php', 1 => 'ArrayObject', ), 'prev' => array ( 0 => 'arrayobject.offsetset.php', 1 => 'ArrayObject::offsetSet', ), 'next' => array ( 0 => 'arrayobject.serialize.php', 1 => 'ArrayObject::serialize', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/spl/arrayobject/offsetunset.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
ArrayObject::offsetUnset — Unsets the value at the specified index
key
The index being unset.
没有返回值。
示例 #1 ArrayObject::offsetUnset() example
<?php
$arrayobj = new ArrayObject(array(0=>'zero',2=>'two'));
$arrayobj->offsetUnset(2);
var_dump($arrayobj);
?>
以上示例会输出:
object(ArrayObject)#1 (1) { [0]=> string(4) "zero" }