RE: [PHP] makeing an array

From: Date: Thu, 02 Jan 2003 14:01:09 +0000
Subject: RE: [PHP] makeing an array
Groups: php.general 
Request: Send a blank email to php-general+get-129939@lists.php.net to get a copy of this message
> -----Original Message----- > From: Sean Malloy [mailto:sean@element.net.au] > Sent: 02 January 2003 13:35 > To: Timothy Hitchens (HiTCHO); php-general@lists.php.net > Subject: RE: [PHP] makeing an array > > > see example 2. But that produces the elements in reverse order -- no use if you want them in their proper order! In whioch case, Hitcho's solution is the right and proper one (and I like the elegance of the two parallel assignments in the loop initializer clause!). > > > > -----Original Message----- > > > > From: Timothy Hitchens (HiTCHO) [mailto:phplists@hitcho.com.au] > > > > Sent: Wednesday, 1 January 2003 4:41 PM > > > > To: Philip J. Newman; php-general@lists.php.net > > > > Subject: Re: [PHP] makeing an array > > > > > > > > > > > > Use the count like following inside to ensure that you don't > > > > call on a non existent index. > > > > > > > > for ($i = 0, $x = count($comment); $i < $x; $i++) > > > > { > > > > echo $comment[$i].'<br />'; > > > > } Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#129939) next »