|
Posted by J.O. Aho on 07/31/05 19:07
paul wrote:
> Sorry, I just haven't done this manually, here's what I want:
>
> $array=
> key,initial,name
> 0,"C","Geoff C."
> 1,"V","Pete V."
> 2,"F","Paul F."
>
> I fumbled around at php.net for a while without finding such a basic thing.
$array=array(array("initial" => "C", "name" => "Geoff C."),
array("initial" => "V", "name" => "Peter V."),
array("initial" => "F", "name" => "Paul F.")
);
http://www.php.net/manual/en/function.array.php
Gives you a array that looks like this:
Array
(
[0] => Array
(
[initial] => C
[name] => Geoff C.
)
[1] => Array
(
[initial] => V
[name] => Peter V.
)
[2] => Array
(
[initial] => F
[name] => Paul F.
)
)
To access data you use
$array[key_number]['initial']
or
$array[key_number]['name']
replace the "key_number" with the number you want to access.
//Aho
[Back to original message]
|