Re: foreach problem part two [message #184280 is a reply to message #184279] |
Fri, 20 December 2013 00:51 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 12/19/2013 6:39 PM, richard wrote:
> On Thu, 19 Dec 2013 22:34:24 +0000 (UTC), Doug Miller wrote:
>
>> richard <noreply(at)example(dot)com> wrote in news:oib4w8z2sr5y$.15xxzxjds0xb0$.dlg@
>> 40tude.net:
>>
>>> <?php
>>> foreach ($aname as $item){
>>> echo $aname[$item][1];
>>> echo " (".$aname[$item][2].")";
>>> }
>>> ?>
>>>
>>> I decided to create a second array that holds only the artist and number of
>>> records.
>>> So why am I getting "invalid argument" with this?
>>
>> Because you don't understand how foreach() works. RTFM.
>
> I did.
> There is a flaw in the works that is not discussed.
> That being, it won't work with brackted arrays.
> Works fine with standard arrays.
>
> While (){}. however works and could care less which is used.
>
What do you mean by "bracketed arrays"? There is no such thing!
foreach() works fine with ANY array.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|