I'm new to PHP so I'm probably making a simple blunder here and I don't even realize it. Anyways, I have an array that is filled with several subarrays. I want to make a copy of it, but don't want the copy to have all of the subarrays, just the first four from each entry. I thought the following code would do it, and when I sprinkle print_rs through it it seems to be doing it, except at the very end I still have the same array at hand (it didnt' really do anything). Any and all help is appreciated.
Code: Select all
$retVal = $gaugeArrayToTrim;
reset($retVal);//sets key to begining
while (list($key, $value) = each($retVal))
{
$tempholder = $value;
$value = array_slice($tempholder, 0, 4);
}