ArrayObject::exchangeArray
Exchange the array for another one.
&reftitle.description;
arrayArrayObject::exchangeArray
mixedinput
Exchange the current array with another array or object.
&reftitle.parameters;
input
The new array or object to exchange with the current array.
&reftitle.returnvalues;
Returns the old array.
&reftitle.examples;
ArrayObject::exchangeArray example
1, "oranges" => 4, "bananas" => 5, "apples" => 10);
// Array of locations in Europe
$locations = array('Amsterdam', 'Paris', 'London');
$fruitsArrayObject = new ArrayObject($fruits);
// Now exchange fruits for locations
$old = $fruitsArrayObject->exchangeArray($locations);
print_r($old);
print_r($fruitsArrayObject);
?>
]]>
&example.outputs;
1
[oranges] => 4
[bananas] => 5
[apples] => 10
)
ArrayObject Object
(
[0] => Amsterdam
[1] => Paris
[2] => London
)
]]>