大网数据广告活动
PHP 语言与运行手册

The ArrayObject class

· 52CE 我爱测

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

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 function __construct(array|object $array = [], int $flags = 0, string $iteratorClass = ArrayIterator::class)
public function append(mixed $value): void
public function asort(int $flags = SORT_REGULAR): true
public function count(): int
public function exchangeArray(array|object $array): array
public function getArrayCopy(): array
public function getFlags(): int
public function getIterator(): Iterator
public function getIteratorClass(): string
public function ksort(int $flags = SORT_REGULAR): true
public function natcasesort(): true
public function natsort(): true
public function offsetExists(mixed $key): bool
public function offsetGet(mixed $key): mixed
public function offsetSet(mixed $key, mixed $value): void
public function offsetUnset(mixed $key): void
public function serialize(): string
public function setFlags(int $flags): void
public function setIteratorClass(string $iteratorClass): void
public function uasort(callable $callback): true
public function uksort(callable $callback): true
public function 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.

更新日志

版本 说明
8.4.0 类常量现在是有类型的。

目录

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。