pulling arrays from nested arrays?
| From: | Doug Brewer | Date: | Sun, 04 Mar 2001 00:21:36 +0000 |
| Subject: | pulling arrays from nested arrays? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-5807@lists.php.net to get a copy of this message | ||
Hello, looking for some insight on the behavior of arrays.
I've got an array. One of the elements of that array is another array.
If I refer to it this way, I can get at it:
while(list($this, $that) = each($first_array["second array"])) {
# it works!
}
But let's say I want to alter the items in the second array, removing
items or sorting differently, so to preserve the original I want to
create a new array equivalent to the second array:
$new_array = $first_array["second array"]; # what's wrong with this?
while(list($this, $that) = each($new_array)) {
# doesn't work!
}
Any ideas or pointers? I've tried:
$new_array = array ($first_array["second array"]);
but no go.
TIA,
Doug