The ArrayObject class

Introduction

This class allows objects to work as arrays.

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

Class synopsis

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

Predefined Constants

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.

Table of Contents