Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: foreach problem part two Date: Fri, 20 Dec 2013 07:52:09 +0100 Lines: 57 Message-ID: <52B3E919.8020109@arnowelzel.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net 9ttEThgW8VMTnZdoFQokKQk0GZ8CwAde69CJiHM14eow9Y74vg Cancel-Lock: sha1:E8/jJx8Bi3ROGpA12Ugs5Hx4Y6g= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-Enigmail-Version: 1.6 Xref: csiph.com comp.lang.php:12323 richard, 2013-12-20 00:39: > On Thu, 19 Dec 2013 22:34:24 +0000 (UTC), Doug Miller wrote: > >> richard wrote in news:oib4w8z2sr5y$.15xxzxjds0xb0$.dlg@ >> 40tude.net: >> >>> >> 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. Sigh... There is no thing like "bracketed arrays" or "standard arrays". This is called one-dimensional and multi-dimensional. And of course foreach() works fine with every kind of array. '; } ?> You just don't understand it - as usual. > While (){}. however works and could care less which is used. As usual. while() needs more code, is slower and is prone to errors. Really - software development is not your thing. It seems you are mentally not capable of understanding the principles. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de