Help needed: Syntax for array of arrays

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
elsi
Forum Newbie
Posts: 2
Joined: Thu Jan 02, 2003 11:18 pm
Location: Texas, USA

Help needed: Syntax for array of arrays

Post by elsi »

I'm basing some PHP on routines provided by another programmer. In the sample, I'm given this example:

Code: Select all

// define all supported sets in your repository
$SETS = array (
	       	array('setSpec'=>'phdthesis', 'setName'=>'PHD Thesis', 'setDescription'=>'') //,
		// array('setSpec'=>'math', 'setName'=>'Mathematics') ,
		// array('setSpec'=>'phys', 'setName'=>'Physics')
			);
I have two sets to define, so I removed the comment // from the end of the first array, deleted the second array and also removed the comment // from the beginning of the third line resulting in code that looks like this:

Code: Select all

$SETS = 	array (
				array('setSpec'=>'photos', 'setName'=>'photos', 'setDescription'=>'Digital photos'),
				array('setSpec'=>'genealogy', 'setName'=>'genealogy' 'setDescription'=>'Family Tree')
			);
Now, when I execute the code, I get this error message:


Code: Select all

Parse error:  parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /u2/elsi/public_html/config.php on line 149
Line 149 happens to be the one defining the 'photos' set. So, is the comma *not* the separator that I want between the two array definitions? Can someone tell me where to look in the PHP documentation to diagnose this error message?

Thanks,
Elsi
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

you are missing a comma after 'setName'=>'genealogy'
elsi
Forum Newbie
Posts: 2
Joined: Thu Jan 02, 2003 11:18 pm
Location: Texas, USA

Post by elsi »

I knew it had to be simple. I didn't look at that line since the error message specifically indicated the error in the one above.

THANK YOU very much.

Elsi

:D
Post Reply