[thelist] Q on array manipulation, part 2...
joe
stowaway at uklinux.net
Fri Jul 9 08:30:44 CDT 2004
jsWalter wrote:
>I have this...
>
> // $recordCount - number of elements in this array
> // $records - multi-dimensional array
>...
>
>I'm trying to pull just a particular "column" out of this array.
>
>Is there a more efficient way to do this?
>
>
hi Walter
I can't think of any pre-defined functions to do what you want, but a
shorter way of doing it might be:
$colNum = 2;
foreach($records as $rec)
{
$results[] = $rec[$colNum];
}
Structurally its doing exactly the same as your example but involves
less typing :)
joe
More information about the thelist
mailing list