FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » foreach problem part two
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: foreach problem part two [message #184298 is a reply to message #184279] Fri, 20 December 2013 18:37 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Thu, 19 Dec 2013 18:39:28 -0500, 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.

Foreach works with all arrays. At the foreach level, all arrays are one-
dimensional, in that foreach works with the topmost dimension of the
array being processed.

The only flaw is your lack of understanding of how foreach works.

If you read and comprehended the manual entry for foreach, you would
realise this.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP sql entry is a godaweful mess
Next Topic: Math Formula Question - Need Ideas
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 19:25:34 GMT 2024

Total time taken to generate the page: 0.03453 seconds