Re: Help with array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



john@jrthorne.com (John Thorne) writes:
> $data[$cpt]= $row[0].",".$row[1].",".$row[2].",".$row[3].",".$row[4];

What you need is a two dimensional array. The code above concatenates
the $row elements into a string and puts this string into a one
dimensional array.

the 2D array $foo[3][5] can be seen as:

   0 1 2 3 4
  +-+-+-+-+-+
0 | | | | | |
  +-+-+-+-+-+
1 | | | | | |
  +-+-+-+-+-+
2 | | | | | |
  +-+-+-+-+-+

and to put stuff into the two dimensions, you need something like
$foo[$i][$j] = "bar";
and iterate over the values $i and $j.


-- 
--Fredrik
"Why be a man when you can be a success?"
		-- Bertold Brecht

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux