ArrayObject
class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable (View source)
This class allows objects to work as arrays.
Constants
STD_PROP_LIST |
Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.). |
ARRAY_AS_PROPS |
Entries can be accessed as properties (read and write). |
Methods
Construct a new array object
Returns whether the requested index exists
Returns the value at the specified index
Sets the value at the specified index to newval
Unsets the value at the specified index
Appends the value
Creates a copy of the ArrayObject.
Get the number of public properties in the ArrayObject When the ArrayObject is constructed from an array all properties are public.
Gets the behavior flags.
Sets the behavior flags.
Sort the entries by value
Sort the entries by key
Sort the entries with a user-defined comparison function and maintain key association
Sort the entries by keys using a user-defined comparison function
Sort entries using a "natural order" algorithm
Sort an array using a case insensitive "natural order" algorithm
Unserialize an ArrayObject
Serialize an ArrayObject
No description
No description
No description
Create a new iterator from an ArrayObject instance
Exchange the array for another one.
Sets the iterator classname for the ArrayObject.
Gets the iterator classname for the ArrayObject.
Details
__construct(TValue[]|object $array = [], int $flags = 0, ArrayIterator> $iteratorClass = "ArrayIterator")
Construct a new array object
bool
offsetExists(TKey $key)
Returns whether the requested index exists
mixed
offsetGet(TKey $key)
Returns the value at the specified index
void
offsetSet(TKey $key, TValue $value)
Sets the value at the specified index to newval
void
offsetUnset(TKey $key)
Unsets the value at the specified index
void
append(TValue $value)
Appends the value
array
getArrayCopy()
Creates a copy of the ArrayObject.
int
count()
Get the number of public properties in the ArrayObject When the ArrayObject is constructed from an array all properties are public.
int
getFlags()
Gets the behavior flags.
void
setFlags(int $flags)
Sets the behavior flags.
asort(int $flags = SORT_REGULAR)
Sort the entries by value
ksort(int $flags = SORT_REGULAR)
Sort the entries by key
uasort($callback)
Sort the entries with a user-defined comparison function and maintain key association
uksort($callback)
Sort the entries by keys using a user-defined comparison function
natsort()
Sort entries using a "natural order" algorithm
natcasesort()
Sort an array using a case insensitive "natural order" algorithm
void
unserialize(string $data)
Unserialize an ArrayObject
string|null
serialize()
Serialize an ArrayObject
array
__debugInfo()
No description
array
__serialize()
No description
void
__unserialize(array $data)
No description
Traversable
getIterator()
Create a new iterator from an ArrayObject instance
array
exchangeArray(mixed $array)
Exchange the array for another one.
void
setIteratorClass(ArrayIterator> $iteratorClass)
Sets the iterator classname for the ArrayObject.
string
getIteratorClass()
Gets the iterator classname for the ArrayObject.