array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'arrayobject.offsetunset.php', 1 => 'ArrayObject::offsetUnset', 2 => 'Unsets the value at the specified index', ), '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', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ArrayObject::offsetUnset

(PHP 5, PHP 7, PHP 8)

ArrayObject::offsetUnsetUnsets the value at the specified index

Опис

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

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) {
  ["storage":"ArrayObject":private]=>
  array(1) {
    [0]=>
    string(4) "zero"
  }
}