# The ArrayObject class

(PHP 5, PHP 7, PHP 8)

## 简介

This class allows objects to work as arrays.

> 注意: Wrapping objects with this class is fundamentally flawed, and therefore its usage with objects is discouraged.

## 类摘要

class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable {
/* 常量 */
public const int STD_PROP_LIST;
public const int ARRAY_AS_PROPS;
/* 方法 */
public __construct(array|object `$array` = [], int `$flags` = 0, string `$iteratorClass` = `ArrayIterator::class`)
public append(mixed `$value`): void
public asort(int `$flags` = `SORT_REGULAR`): true
public count(): int
public exchangeArray(array|object `$array`): array
public getArrayCopy(): array
public getFlags(): int
public getIterator(): Iterator
public getIteratorClass(): string
public ksort(int `$flags` = `SORT_REGULAR`): true
public natcasesort(): true
public natsort(): true
public offsetExists(mixed `$key`): bool
public offsetGet(mixed `$key`): mixed
public offsetSet(mixed `$key`, mixed `$value`): void
public offsetUnset(mixed `$key`): void
public serialize(): string
public setFlags(int `$flags`): void
public setIteratorClass(string `$iteratorClass`): void
public uasort(callable `$callback`): true
public uksort(callable `$callback`): true
public unserialize(string `$data`): void
}

## 预定义常量

## ArrayObject Flags

`ArrayObject::STD_PROP_LIST`

  Properties of the object have their normal functionality when accessed as list (var_dump(), `foreach`, etc.).

`ArrayObject::ARRAY_AS_PROPS`

  Entries can be accessed as properties (read and write). The ArrayObject class uses its own logic to access properties, thus no warning or error is raised when trying to read or write dynamic properties.

## 目录

- ArrayObject::append — 追加新的值作为最后一个元素。
- ArrayObject::asort — Sort the entries by value
- ArrayObject::__construct — Construct a new array object
- ArrayObject::count — 统计 ArrayObject 内 public 属性的数量
- ArrayObject::exchangeArray — Exchange the array for another one
- ArrayObject::getArrayCopy — Creates a copy of the ArrayObject
- ArrayObject::getFlags — Gets the behavior flags
- ArrayObject::getIterator — Create a new iterator from an ArrayObject instance
- ArrayObject::getIteratorClass — Gets the iterator classname for the ArrayObject
- ArrayObject::ksort — Sort the entries by key
- ArrayObject::natcasesort — Sort an array using a case insensitive "natural order" algorithm
- ArrayObject::natsort — Sort entries using a "natural order" algorithm
- ArrayObject::offsetExists — Returns whether the requested index exists
- ArrayObject::offsetGet — Returns the value at the specified index
- ArrayObject::offsetSet — 为指定索引设定新值
- ArrayObject::offsetUnset — Unsets the value at the specified index
- ArrayObject::serialize — Serialize an ArrayObject
- ArrayObject::setFlags — Sets the behavior flags
- ArrayObject::setIteratorClass — Sets the iterator classname for the ArrayObject
- ArrayObject::uasort — Sort the entries with a user-defined comparison function and maintain key association
- ArrayObject::uksort — Sort the entries by keys using a user-defined comparison function
- ArrayObject::unserialize — Unserialize an ArrayObject

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open