PHP | ArrayIterator append() Function Last Updated : 21 Nov, 2019 Comments Improve Suggest changes Like Article Like Report 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 function does not return any value. Below programs illustrate the ArrayIterator::append() function in PHP: Program 1: php <?php // Declare an ArrayIterator $arrItr = new ArrayIterator( array('G', 'e', 'e', 'k', 's') ); // Append the element into array iterator $arrItr->append("123"); // Display the elements while($arrItr->valid()) { echo $arrItr->current(); $arrItr->next(); } ?> Output: Geeks123 Program 2: php <?php // Declare an ArrayIterator $arrItr = new ArrayIterator( array( "a" => "Geeks", "b" => "for", "c" => "Geeks" ) ); // Append the array element $arrItr->append("Computer"); $arrItr->append("Science"); $arrItr->append("Portal"); // Display the elements foreach ($arrItr as $key => $val) { echo $key . " => " . $val . "\n"; } ?> Output: a => Geeks b => for c => Geeks 0 => Computer 1 => Science 2 => Portal Reference: https://www.php.net/manual/en/arrayiterator.append.php Comment More infoAdvertise with us Next Article PHP | ArrayIterator append() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | AppendIterator append() Function The AppendIterator::append() function is an inbuilt function in PHP which is used to append an iterator. Syntax: void AppendIterator::append( Iterator $iterator ) Parameters: This function accepts single parameter $iterator which holds the iterator to append. Return Value: This function does not ret 1 min read PHP | AppendIterator key() Function The AppendIterator::key() function is an inbuilt function in PHP which is used to return the current key. Syntax: scalar AppendIterator::key( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the current key if it is valid or NULL otherwise. Below p 2 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 PHP | ArrayIterator key() Function The ArrayIterator::key() function is an inbuilt function in PHP which returns the current key of the array element. Syntax: mixed ArrayIterator::key( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the current array key. Below programs illustrate 1 min read PHP | AppendIterator valid() Function The AppendIterator::valid() function is an inbuilt function in PHP which is used to check the validity of the current element. Syntax: bool AppendIterator::valid( void ) Parameters: This function does not accept any parameters. Return Value: This function returns TRUE if the current iteration is val 1 min read Like