PHP 5.6.0RC3 is available

ArrayIterator::getArrayCopy

(PHP 5 >= 5.0.0)

ArrayIterator::getArrayCopyGet array copy

Description

public array ArrayIterator::getArrayCopy ( void )

Get a copy of an array.

Warning

This function is currently not documented; only its argument list is available.

Parameters

This function has no parameters.

Return Values

A copy of the array, or array of public properties if ArrayIterator refers to an object.

See Also

add a note add a note

User Contributed Notes 1 note

up
0
lenye01 at gmail dot com
3 years ago
the difference of this method and the direct assign the object to a value is as follows:

<?php
$b
= array('name'=>'mengzhi','age'=>'12','city'=>'shanghai');
$a = new ArrayIterator($b);
$a->append(array('home'=>'china','work'=>'developer'));
$c = $a->getArrayCopy();
var_dump($a);
var_dump($c);
?>
result:
object(ArrayIterator)#1 (1) { ["storage":"ArrayIterator":private]=> array(4) { ["name"]=> string(7) "mengzhi" ["age"]=> string(2) "12" ["city"]=> string(8) "shanghai" [0]=> array(2) { ["home"]=> string(5) "china" ["work"]=> string(9) "developer" } } }

array(4) { ["name"]=> string(7) "mengzhi" ["age"]=> string(2) "12" ["city"]=> string(8) "shanghai" [0]=> array(2) { ["home"]=> string(5) "china" ["work"]=> string(9) "developer" } }
To Top