Parameters
- obj - the object to be added to the collection
- index (optional) default value: null - the position to insert the object into the collection
Description
The add function adds an object into the collection. If no index is given, the object is added to the end of the collection, otherwise, the object is inserted into the collection at the given index.
Example(s)
// example adding an object to the end of a collection $myCollection->add($myObject); // example adding an object to index 3 of the collection $myCollection->add($myObject, 3);
