The ArrayObject class
Introduction
(PHP 5, PHP 7)
This class allows objects to work as arrays.
Class synopsis
/* Constants */
/* Methods */
public __construct ([ mixed
$input
= array() [, int $flags
= 0 [, string $iterator_class
= "ArrayIterator" ]]] )public append ( mixed $value ) : void
public asort ([ int $flags = SORT_REGULAR ] ) : void
public count ( ) : int
public exchangeArray ( mixed $input ) : array
public getArrayCopy ( ) : array
public getFlags ( ) : int
public getIterator ( ) : ArrayIterator
public getIteratorClass ( ) : string
public ksort ([ int $flags = SORT_REGULAR ] ) : void
public natcasesort ( ) : void
public natsort ( ) : void
public offsetExists ( mixed $index ) : bool
public offsetGet ( mixed $index ) : mixed
public offsetSet ( mixed $index , mixed $newval ) : void
public offsetUnset ( mixed $index ) : void
public serialize ( ) : string
public setFlags ( int $flags ) : void
public setIteratorClass ( string $iterator_class ) : void
public uasort ( callable $cmp_function ) : void
public uksort ( callable $cmp_function ) : void
public unserialize ( string $serialized ) : void}
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).
Changelog
Version | Description |
---|---|
5.3.0 | Implements Serializable. |
Table of Contents
- ArrayObject::append — Appends the value
- ArrayObject::asort — Sort the entries by value
- ArrayObject::__construct — Construct a new array object
- ArrayObject::count — Get the number of public properties in the ArrayObject
- 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 — Sets the value at the specified index to newval
- 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
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.arrayobject.php