Php/docs/arrayobject.offsetunset

来自菜鸟教程
机器人讨论 | 贡献2020年12月10日 (四) 14:36的版本 (autoload)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至:导航、​搜索

ArrayObject::offsetUnset

(PHP 5, PHP 7)

ArrayObject::offsetUnsetUnsets the value at the specified index


说明

public ArrayObject::offsetUnset ( mixed $index ) : void

Unsets the value at the specified index.


参数

index
The index being unset.


返回值

没有返回值。


范例

Example #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"
}