Page 1 of 1

Help needed: Syntax for array of arrays

Posted: Thu Jan 02, 2003 11:18 pm
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

Posted: Thu Jan 02, 2003 11:44 pm
by mydimension
you are missing a comma after 'setName'=>'genealogy'

Posted: Fri Jan 03, 2003 12:10 am
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