Collection
interface Collection implements Countable, IteratorAggregate, JsonSerializable (View source)
Collection is the base interface which covers functionality common to all the data structures in this library. It guarantees that all structures are traversable, countable, and can be converted to json using json_encode().
Methods
Removes all values from the collection.
Returns a shallow copy of the collection.
Returns whether the collection is empty.
Converts the collection to an array.
Details
int
count()
Count elements of an object
Traversable
getIterator()
Retrieve an external iterator
mixed
jsonSerialize()
Specify data which should be serialized to JSON
void
clear()
Removes all values from the collection.
TValue>
copy()
Returns a shallow copy of the collection.
bool
isEmpty()
Returns whether the collection is empty.
array
toArray()
Converts the collection to an array.
Note: Casting to an array is not supported yet.