Re: Re: Simple PHP setting arrays with keys question
| From: | Jim Lucas | Date: | Tue, 10 Jul 2007 15:26:43 +0000 |
| Subject: | Re: Re: Simple PHP setting arrays with keys question | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-258555@lists.php.net to get a copy of this message | ||
Tijnema wrote:
On 7/10/07, Jim Lucas <lists@cmsws.com> wrote::) -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William ShakespeareFredrik Thunberg wrote:Dan skrev:either: $products[$value['productName']] = $value['actualValue']; OR $products[] = array( $value['productName'] => $value['actualValue'] );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@gmail.com> wrote in message news:93.D2.03277.CF2D2964@pb1.pair.com...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!But these are not the same... -- Jim LucasThis one is: $products += array( $value['productName'] => $value['actualValue'] ); :) Tijnema well, I was leaving it up to Fredrik to figure out in what way they were different