Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread Robert Cummings
On Sun, 2006-12-17 at 23:19 +, julian haffegee wrote: > > will set the element of ordinal number 0 and key ' 2' to 'dog'. To get > > that value you would either ask for $array[0] or $array[' 2']. > > > thanks for all the comments so far, i'm not sure you are understanding what > I am askin

Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread julian haffegee
will set the element of ordinal number 0 and key ' 2' to 'dog'. To get that value you would either ask for $array[0] or $array[' 2']. thanks for all the comments so far, i'm not sure you are understanding what I am asking for. My problem is NOT knowing what is in the arrays, but how to ac

Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread Jochem Maas
don't hijack an existing thread. (i.e. don't reply to someone elses' post/reply if your asking a new question. you need to learn to use var_dump(), and if you look at the line of code below you should have everything you need to know about numeric array keys: $a = array(2 => "foo"); $b = array("2

Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread Satyam
- Original Message - From: "julian haffegee" <[EMAIL PROTECTED]> To: Sent: Sunday, December 17, 2006 7:31 PM Subject: [PHP] PHP problem with array keys / pointers Hi all, I've a problem thats been bothering me for a week now I have an array $animals keys an

Re: [PHP] PHP problem with array keys / pointers

2006-12-17 Thread Pintér Tibor
1 => cat 2 => dog 3 => mouse 4 => horse iwfm with array(1=>'cat',2=>'dog',3=>'mouse',4=>'horse'): output: Array ( [1] => cat [2] => dog [3] => mouse [4] => horse ) dog source: 'cat',2=>'dog',3=>'mouse',4=>'horse'); print_r($animals); $x=2; echo $animals[$x]."\n"; ?> t -- PHP Gen

[PHP] PHP problem with array keys / pointers

2006-12-17 Thread julian haffegee
Hi all, I've a problem thats been bothering me for a week now I have an array $animals keys and values like this 1 => cat 2 => dog 3 => mouse 4 => horse I want to be able to access them using either a key or a pointer, however the key/pointer will be a variable without variables, if I want