[thelist] Q on array manipulation, part 2...
jsWalter
jsWalter at torres.ws
Fri Jul 9 02:42:33 CDT 2004
I have this...
// $recordCount - number of elements in this array
// $records - multi-dimensional array
// $records [0] [1,2,3,4,5,6,7,8,9,0]
// $records [1] [1,2,3,4,5,6,7,8,9,0]
// ...
// $records [n] [1,2,3,4,5,6,7,8,9,0]
// $colNum - which element from the secondary array do I want
for ($i = 0; $i < $recordCount; $i++)
$results[] = $records[$i][$colNum];
// $results - new single dimension array of just the desired secondary
element
// i.e: $colNum = 2
// $results = (3,3...3)
I'm trying to pull just a particular "column" out of this array.
Is there a more efficient way to do this?
Thanks
Walter
More information about the thelist
mailing list