La classe ArrayObject

(PHP 5, PHP 7)

Introduction

Cette classe permet aux objets de fonctionner comme des tableaux.

Synopsis de la classe

ArrayObject implements IteratorAggregate , ArrayAccess , Serializable , Countable {
/* Constantes */
const int STD_PROP_LIST = 1 ;
const int ARRAY_AS_PROPS = 2 ;
/* Méthodes */
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 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
}

Constantes pré-définies

Options de ArrayObject

ArrayObject::STD_PROP_LIST

Les propriétés de l'objet ont leur fonctionnement normal lorsqu'on y accède depuis la liste (var_dump(), foreach, etc.).

ArrayObject::ARRAY_AS_PROPS

Il est possible d'accéder aux éléments comme des propriétés (lecture et écritre).

Historique

Version Description
5.3.0 Implémente Serializable.

Sommaire