[thelist] PHP: Inserting data from one column of data to the first index in a multideminsional array

**1st Vamp** wes at pmason.karoo.co.uk
Wed Mar 12 14:45:54 CST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: MD5

Yes, realised I mistyped my example after sending.

- --
1stVamp
[ Site at somewhere :: http://1stvamp.org/ ]
[ Webcomic from nowhere :: http://gfbowl.com/ ]

Wednesday, March 12, 2003, 8:40:02 PM, Carl J Meyer wrote:

> On Wed, 2003-03-12 at 12:12, **1st Vamp** wrote:
>> Example:
>> $array[0] = 'tick';
>> $array[1] = 'tock';
>> $array[0][0] = 'foo';
>> $array[1][0] = 'bar';

> This array is not possible in PHP.  If $array[0][0] has a value, then
> $array[0] must be an array, not a string (such as 'tick').

> If you're treating a multidimensional array as a table, and your "table"
> looks like this:
>         col0  |   col1
> row0 | 'tick' |  'foo'
> row1 | 'tock' |  'bar'

> Then your PHP array could look like
> $array[0][0] = 'tick';
> $array[0][1] = 'tock';
> $array[1][0] = 'foo';
> $array[1][1] = 'bar';

> And if you want to set the values in the first column equal to the
> values in the Nth column of such a table:

> $array[0] = $array[N];

> HTH,
> Carl

-----BEGIN PGP SIGNATURE-----
Version: 2.6

iQIMAwUAPm+ciOtR7En81eJTAQF5rQ+2Og8VH7iZwtQWSFVEJgI1aIioSYvExTuD
GAyphUCL9GZ73lMMhUyLMUmnSC4LwwlPbddAW4HoYnIH5zwArPqxKYaEWYm5/gWS
4gK7cRCeQUCDFPsE7uzNtleS/sugnIIe1DnfKXpRi1OZZhEyIZW0xqYf4HlVxtDT
Mv+y1UAdDvozDeS94VI/jgndt0u1OZN+W9aGnLxQgeKWDLEt6TN5z+tQGkYM5KZ1
UaBvpsxkY2FuvsNUT7Er2ZznOT9ypEoJNaWOIXx9llN3WWfvT+ub6mjWI93LcgWb
HzwArvRU5qIbQ6rZZgAJsqonG8r08y0s/rY9ND+ex2FinyXGYz4vR52w/vkuTN6L
GNZYDp3JGOFiHZ0bH1NUog/0cCD+hytzfp76sglG1bS3LGtOuxB2Q+IvoxTYZOfw
W42HPu4qtn9wOPCy9TyG43cTFYP7dSSDESW90ptiXOEsy+LU7WDBjIWf6cXYmS9O
OBCYwFLOT7hOlKeqjNWsJGe37EILxQJpMrF3Vd2LAYFfhIAokAoD+tiANuNumO4v
WmYB4bzowmc/DhFoWGbrKLwU8jL6YwpKtPLxBuKlvRbPEeEsaTqJiW63b+JwOE++
v00rO0v4AcIRMV6wO16Sz+92PNfrXApSHjg0nLu99ue6agC2csZbce1eQ8S3wzQ=
=sDgI
-----END PGP SIGNATURE-----



More information about the thelist mailing list