Page 1 of 1

Problem with nested array

Posted: Tue Feb 05, 2008 5:06 pm
by Mplunket
I have the following declaration:

***** PLEASE USE THE

Code: Select all

TAG WHEN POSTING *****[/color]

Code: Select all

<?php
 
$gweapons = array(
        'knives'=>
          array('name'=>'Knives', 'cost'=>'50', 'sellback'=>'40', 'imgsrc'=>'knives.jpg'),
        'pistols'=>
          array('name'=>'Pistols', 'cost'=>'125', 'sellback'=>'95', 'imgsrc'=>'pistols.jpg'),
        'shotguns'=>
          array('name'=>'Shotguns', 'cost'=>'300', 'sellback'=>'240', 'imgsrc'=>'shotguns.jpg'),
        'ak47s'=>
          array('name'=>'AK-47s', 'cost'=>'500', 'sellback'=>'400', 'imgsrc'=>'ak47s.jpg'),
        'rpgs'=>
          array('name'=>'RPGs', 'cost'=>'2000', 'sellback'=>'1600', 'imgsrc'=>'rpgs.jpg'),
        )
 
?>
I've isolated the error to this declaration, but can't find the error!

Re: Problem with nested array

Posted: Tue Feb 05, 2008 5:11 pm
by Christopher
It needs a semi-colon after the final paren.

Re: Problem with nested array

Posted: Tue Feb 05, 2008 5:12 pm
by Mplunket
d'oh, always the smallest thing...