Re: EZ array problem - What's wrong with my brain?

From: Date: Fri, 01 Dec 2006 14:29:53 +0000
Subject: Re: EZ array problem - What's wrong with my brain?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-245399@lists.php.net to get a copy of this message
Hi Jochem, I meant "overly-complicated" in this specific context. If each key of this array is going to contain only one value why not reduce the array to something like this : array(1) { ["1.2"]=> array(2) { ["code"]=> string(3) "111" ["status"]=> string(3) "new" } } That's all I was referring to ... Jochem Maas wrote: > Youri LACAN-BARTLEY wrote: >> 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". >> >> I must say this looks like an overly complicated array for what it >> serves. A little OOP could come in handy to organize all that in more >> friendly and efficient way ... > > efficient? overly-complicated? > > php arrays are made for stuff like this. > >> 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 >>> >

« previous php.general (#245399) next »