loader image Authenticating...

Create Array copy using php

by Jayanthi 2012-05-29 17:01:47

Php: Create a Copy of Array using Array object

<?php
// Array of available fruits
$members = array("john" => 1, "white" => 4, "blake" => 5, "lason" => 10);

//original array
print_r($members);

$membersArrayObject = new ArrayObject($members);
$membersArrayObject['jummy'] = 4;

// create a copy of the array
$copy = $membersArrayObject->getArrayCopy();

//First copy
print_r($copy);

$membersArrayObject['jeni'] = 6;
$seccopy = $membersArrayObject->getArrayCopy();

//Second copy
print_r($seccopy);

?>

Tagged in:

252
like
0
dislike
0
mail
flag

You must LOGIN to add comments