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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Youri LACAN-BARTLEY wrote:
> 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 ...

ah yes - I can see your point!

> 
> 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
>>>>
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux