RE: [PHP] Newbie: array help....

From: Date: Mon, 22 Jan 2001 18:00:15 +0000
Subject: RE: [PHP] Newbie: array help....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36042@lists.php.net to get a copy of this message
I apparently misunderstood your implementation, your right, it does work perfectly.... Thank you! > -----Original Message----- > From: Ignacio Vazquez-Abrams [mailto:ignacio@openservices.net] > Sent: Monday, January 22, 2001 12:27 PM > To: Brian V Bonini > Cc: PHP Lists > Subject: RE: [PHP] Newbie: array help.... > > > On Mon, 22 Jan 2001, Brian V Bonini wrote: > > > That's what I thought, which seemed to be the obvious > > however, when I tried that it returns an error. > > > > "Warning: Variable passed to each() is not an array or object > in pagetop.inc > > on line 105" > > > > PHP Version 4.0B2 > > BSDI BSD/OS 4.0.1 > > Zend Engine v0.90, > > > > I reimplemented your snippet from first principles, and here's > what I came up > with (reformatted and XHTMLized): > > <table> > <?php > > $bikes = array( > "Road" => array( > "Trek 5200" => "URL", > "Schwinn Fastback Pro" => "URL", > "Va Moots" => "url" > ), > "Mountain" => array( > "Trek Fuel 90" => "url", > "Schwinn Homegrown" => "url" > ), > "BMX" => array( > "Haro Mira 540" => "url", > "Schwinn Powermatic Pro" => "url" > ), > "Kids" => array( > "Schwinn Tiger" => "put URL here", > "Schwinn Bumblebee" => "URL" > ) > ); > > while (list($val, $key)=each($bikes["Road"])) > { > ?> > <td><img src="images/spacer.gif" width="25" height="1" > alt="" > border="0" /></td> > <td><a href="<?=$key?>" > class="menu"><?=$val?></a></td> > <?php > }; > > ?> > </table> > > Works perfectly. > > -- > Ignacio Vazquez-Abrams <ignacio@openservices.net> > >

« previous php.general (#36042) next »