http://www.php.net/manual/en/language.types.array.php If you check out the documentation on arrays, you will see the second code example shows the expected behavior of arrays in this case. $arr = array("foo" => "bar", 12 => true); echo $arr["foo"]; // bar echo $arr[12]; // 1 Now, since each element can be indexed by either a string or an integer, then you can do something like this: $arr = array("1.2" => array(1,2,3,4)); $arr[0] = & $arr["1.2"]; That would set up your doubly indexed array so that you could use either associative keys or numeric keys. http://www.php.net/manual/en/language.references.php PHP.net can explain how references work better than I can. Basically it creates a "symbolic link" (to use a *nix term) to the key "1.2". It shouldn't take up too much memory to do that. -- Ray Hauge Application Development Lead American Student Loan Services www.americanstudentloan.com -----Original Message----- From: Fredrik Thunberg [mailto:thunis@xxxxxxxxxxxxxxxxxxx] Sent: Friday, December 01, 2006 8:52 AM To: Brian Dunning; php-general@xxxxxxxxxxxxx Subject: Re: EZ array problem - What's wrong with my brain? Try $try = $var["1.2"]; If your array looks like the one below then there is no $var[0] and therefore you get NULL /Thunis Brian Dunning skrev: > That seems right to me too - but everything I try returns NULL. I set > $try=$var[0], and $try ends up being null; print_r($try) gives blank. > I even tried $try=$var[1] and it was the same result. Am I in the > Twilight Zone? > > > On Dec 1, 2006, at 12:26 AM, Youri LACAN-BARTLEY wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Well, I've only just fallen out of bed, but I'd say you'd be able to >> access it via $var[0][0][0] as in $var["1.2"]["code"][0] to change 111 >> to something else and $var["1.2"]["status"][0] to set/change "new". >> >> Brian Dunning wrote: >>> var_dump() gives me this: >>> >>> array(1) { >>> ["1.2"]=> >>> array(2) { >>> ["code"]=> >>> array(1) { >>> [0]=> >>> string(3) "111" >>> } >>> ["status"]=> >>> array(1) { >>> [0]=> >>> string(3) "new" >>> } >>> } >>> } >>> >>> I'm trying to set a variable to that "1.2". Shouldn't I be able to get >>> it with $var = $arr[0][0]? >>> >>> --PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.5 (MingW32) >> >> iD8DBQFFb+cnWC9/YPePNU4RAmnzAKDGUlHxZiQvyhLfSiHKXV9sI73fTQCfe/Ub >> pKYeQqK4FcNhmTdEIm41kic= >> =PSbi >> -----END PGP SIGNATURE----- > > --PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php