Re: PHP problem with array keys / pointers

From: Date: Sun, 17 Dec 2006 23:19:11 +0000
Subject: Re: PHP problem with array keys / pointers
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.general 
Request: Send a blank email to php-general+get-245932@lists.php.net to get a copy of this message
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 access them. My ordial number/key is a variable, and I need to sometimes use it as a key, and sometimes as an ordial so I need 2 ways of writing $array[$x], one being equivalent to $array[0] - $x is treated as an integer and one being equivalentt to $array['0'] - $x is treated as a string so far I can only get it to work as an ordial number not a string. Any attempt at apostrophes around $x brings up an error Any ideas? Jules

« previous php.general (#245932) next »