Re: Re: Simple PHP setting arrays with keys question

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

 



On 7/10/07, Jim Lucas <lists@xxxxxxxxx> wrote:
Fredrik Thunberg wrote:
>
> Dan skrev:
>> Oh yeah, the problem isn't that I'm using -> instead of =>.  Well that
>> was a problem but I fixed that and it's still not working.
>>
>> - Dan
>>
>> ""Dan"" <frozendice@xxxxxxxxx> wrote in message
>> news:93.D2.03277.CF2D2964@xxxxxxxxxxxxxxx
>>> I'm having a little problem assigning a value to an array which has a
>>> key. It's simple, I just don't know what I'm doing wrong.
>>>
>>>                foreach($Checkout as $value)
>>>               {
>>>                   $products[] = $value['productName'] ->
>>> $value['actualValue'];
>>>                }
>>>
>>> HELP!
>>
>
> either:
>
> $products[$value['productName']] = $value['actualValue'];
>
> OR
>
> $products[] = array( $value['productName'] => $value['actualValue'] );
>
But these are not the same...

--
Jim Lucas

This one is:
$products += array( $value['productName'] => $value['actualValue'] );

:)

Tijnema

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

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