Problem with nested array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mplunket
Forum Newbie
Posts: 2
Joined: Tue Feb 05, 2008 5:03 pm

Problem with nested array

Post 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!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Problem with nested array

Post by Christopher »

It needs a semi-colon after the final paren.
(#10850)
Mplunket
Forum Newbie
Posts: 2
Joined: Tue Feb 05, 2008 5:03 pm

Re: Problem with nested array

Post by Mplunket »

d'oh, always the smallest thing...
Post Reply