On Monday 29 September 2008 09:34:10 pm It flance wrote:
> Hi,
>
> below you will find the code for a small script where i'm able to extract a
> row but not a column.
>
> So the question is how can I do that.
>
> Here is the code:
>
> <?php
>
> $arr = array(
>                 array('00', '01', '02', '03'),
>                 array('10', '11', '12', '13'),
>                 array('20', '21', '22', '23'),
>         );
>
> $row = $arr[0];
> $col = $arr[][0];
> print_r($row);
> print "\n";
> print_r($col);
> ?>

If you know the column index of the array, you can do it easily.

$row = $arr[0]; // gives you -array('00', '01', '02', '03')

Now use this to get the first column -

<?

for( $i=0; $i <= count($arr); $i++ ) {

$col[$i] = $arr[$i][0];

}

print_r($col);

?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to