SplTempFileObject::__construct
ArrayObject
SPL
PHP Manual

# Miscellaneous Classes and Interfaces

Table of Contents

- ArrayObject — The ArrayObject class
  - 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
- SplObserver — The SplObserver interface
  - SplObserver::update — Receive update from subject
- SplSubject — The SplSubject interface
  - SplSubject::attach — Attach an SplObserver
  - SplSubject::detach — Detach an observer
  - SplSubject::notify — Notify an observer

Classes and interfaces which do not fit into the other SPL categories.

# The ArrayObject class

## Introduction

This class allows objects to work as arrays.

## Class synopsis

ArrayObject
class ArrayObject implements IteratorAggregate , ArrayAccess , Serializable , Countable {
/* Constants */
const integer STD_PROP_LIST = 1 ;
const integer ARRAY_AS_PROPS = 2 ;
/* Methods */
public __construct ([ mixed `$input` = [] [, int `$flags` = 0 [, string `$iterator_class` = "ArrayIterator" ]]] )
public void append ( mixed `$value` )
public void asort ( void )
public int count ( void )
public array exchangeArray ( mixed `$input` )
public array getArrayCopy ( void )
public int getFlags ( void )
public ArrayIterator getIterator ( void )
public string getIteratorClass ( void )
public void ksort ( void )
public void natcasesort ( void )
public void natsort ( void )
public bool offsetExists ( mixed `$index` )
public mixed offsetGet ( mixed `$index` )
public void offsetSet ( mixed `$index` , mixed `$newval` )
public void offsetUnset ( mixed `$index` )
public void serialize ( void )
public void setFlags ( int `$flags` )
public void setIteratorClass ( string `$iterator_class` )
public void uasort ( callable `$cmp_function` )
public void uksort ( callable `$cmp_function` )
public void unserialize ( string `$serialized` )
}

## 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.

# The SplObserver interface

## Introduction

The SplObserver interface is used alongside SplSubject to implement the Observer Design Pattern.

## Interface synopsis

SplObserver
class SplObserver {
/* Methods */
abstract public void update ( SplSubject `$subject` )
}

# The SplSubject interface

## Introduction

The SplSubject interface is used alongside SplObserver to implement the Observer Design Pattern.

## Interface synopsis

SplSubject
class SplSubject {
/* Methods */
abstract public void attach ( SplObserver `$observer` )
abstract public void detach ( SplObserver `$observer` )
abstract public void notify ( void )
}