ArrayObject getArrayCopy() Function in PHP Last Updated : 21 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 returns an array which is the copy of the array in this ArrayObject. Below programs illustrate the above function: Program 1: php <?php // PHP program to illustrate the // getArrayCopy() function $arr = array("a" => "geeks", "b" => "are", "c" => "awesome"); // Create array object $arrObject = new ArrayObject($arr); // Create the copy array $copyArr = $arrObject->getArrayCopy(); print_r($copyArr); ?> Output: Array ( [a] => geeks [b] => are [c][/c] => awesome ) Program 2: php <?php // PHP program to illustrate the // getArrayCopy() function $arr = array("a" => "Welcome", "b" => "2", "d" => "GFG"); // Create array object $arrObject = new ArrayObject($arr); // Create the copy array $copyArr = $arrObject->getArrayCopy(); print_r($copyArr); ?> Output: Array ( [a] => Welcome [b] => 2 [d] => GFG ) Reference: http://php.net/manual/en/arrayobject.exchangearray.php Comment More infoAdvertise with us Next Article PHP | ArrayIterator getArrayCopy() Function G gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-array PHP-function PHP-ArrayObject +1 More Similar Reads ArrayObject getIterator() Function in PHP The getIterator() function of the ArrayObject class in PHP is used to create an iterator from an ArrayObject instance. This iterator can be used to iterate through the array of the respective ArrayObject. Syntax: ArrayIterator getIterator() Parameters: This function does not accepts any parameters. 1 min read PHP | ArrayIterator getArrayCopy() Function The ArrayIterator::getArrayCopy() function is an inbuilt function in PHP which is used to create a copy of an array. Syntax: array ArrayIterator::getArrayCopy( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the copy of array. Below programs illus 1 min read PHP | ArrayObject getFlags() Function The ArrayObject::getFlags() function is an inbuilt function in PHP which is used to get the behavior of flags of the ArrayObject. Syntax: int ArrayObject::getFlags( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the behavior flags of the ArrayObj 2 min read ArrayObject exchangeArray() function in PHP The exchangeArray() function of the ArrayObject class in PHP is used to exchange an array from an ArrayObject. That is, it replaces existing array from an ArrayObject with a newly described array. Syntax: ArrayObject exchangeArray( $inputArray ) Parameters: This function accepts a single parameter $ 2 min read ArrayObject asort() Function in PHP The asort() function of the ArrayObject class in PHP is used to sort all of the entries of the ArrayObject according to the values. The elements are arranged according to the values keeping the maintaining the association of the keys with the value. Syntax: void asort() Parameters: This function doe 1 min read ArrayObject ksort() Function in PHP The ksort() function of the ArrayObject class in PHP is used to sort the elements of the ArrayObject according to the keys. This function does not affects the association of the keys with the values, it just sorts the entries of the ArrayObject according to the Keys. Syntax: void ksort() Parameters: 2 min read Like