ArrayObject append() function in PHP Last Updated : 22 Mar, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The append() function of the ArrayObject class in PHP is used to append a given value onto an ArrayObject. The value being appended can be a single value or an array itself. Syntax: void append($value) Parameters: This function accepts a single parameter $value, representing the value to be appended. Return Value: This function does not returns any value. Below programs illustrate the above function: Program 1: php <?php // PHP function to illustrate the // append() method $arrObj = new ArrayObject(array('Geeks', 'for', 'Geeks')); $arrObj->append('welcomes you'); var_dump($arrObj); ?> Output: object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(4) { [0]=> string(5) "Geeks" [1]=> string(3) "for" [2]=> string(5) "Geeks" [3]=> string(12) "welcomes you" } } Program 2: php <?php // PHP function to illustrate the // append() method $arrObj = new ArrayObject(array('Geeks', 'for', 'Geeks')); // Appending an array $arrObj->append(array('welcomes', 'you')); var_dump($arrObj); ?> Output: object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(4) { [0]=> string(5) "Geeks" [1]=> string(3) "for" [2]=> string(5) "Geeks" [3]=> array(2) { [0]=> string(8) "welcomes" [1]=> string(3) "you" } } } Reference: http://php.net/manual/en/arrayobject.append.php Comment More infoAdvertise with us Next Article ArrayObject offsetSet() Function in PHP G gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-array PHP-function PHP-ArrayObject +1 More Similar Reads PHP | ArrayIterator append() Function The ArrayIterator::append() function is an inbuilt function in PHP which is used to append an element into an array iterator. Syntax: void ArrayIterator::append( mixed $value ) Parameters: This function accepts single parameter $value that holds the value that need to be append. Return Value: This f 1 min read ArrayObject offsetSet() Function in PHP The offsetSet() function of the ArrayObject class in PHP is used to update the value present at a specific index in the ArrayObject. Syntax: void offsetSet($index, $val) Parameters: This function accepts two parameters $index and $val. This function updates the value present at the index, $index wit 1 min read ArrayObject offsetGet() Function in PHP The offsetGet() function of the ArrayObject class in PHP is used to get the value present at a specific index at the ArrayObject. Syntax: mixed offsetGet($index) Parameters: This function accepts a single parameter $index for which corresponding value will be returned. Return Value: This function re 1 min read PHP | ArrayObject count() Function The ArrayObject::count() function is an inbuilt function in PHP which is used to get the number of public properties in the ArrayObject. Syntax: int ArrayObject::count( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the number of public propertie 1 min read ArrayObject getArrayCopy() Function in PHP The getArrayCopy() function of the ArrayObject class in PHP is used to create a copy of this ArrayObject. This function returns the copy of the array present in this ArrayObject. Syntax: array getArrayCopy() Parameters: This function does not accepts any parameters. Return Value: This function retur 1 min read PHP | AppendIterator next() Function The AppendIterator::next() function is an inbuilt function in PHP which is used to move the element into the next element. Syntax: void AppendIterator::next( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustr 2 min read Like