Re: array() stuff

From: Date: Thu, 12 Apr 2001 02:05:48 +0000
Subject: Re: array() stuff
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48229@lists.php.net to get a copy of this message
Dude, you need commas between your array items. ---------------------------------------------------------------------------- Gfunk - josh@gfunk007.com - http://www.gfunk007.com/ ----- Original Message ----- From: "Duke" <kidlinux@rocketbox.dhs.org> To: <php-general@lists.php.net> Sent: Thursday, April 12, 2001 12:05 PM Subject: [PHP] array() stuff > I'm trying to create the following array: > > $host_info = array( > "hostname" => "localhost" > "log" => "rocketbox_db.log" > "username" => $username > "password" => $password > "database" => "rocketbox" > "table" => $table > ); > > however when I try and access the document, I get the following error: > > Parse error: parse error, expecting `')'' in > /usr/home/kidlinux/htdocs/rocketbox/admin/index.php on line 26 > > line 26 is \* "log" => "rocketbox_db.log" *\ in the array code I > pasted above. This isn't very far into my script, and I'm sure I havn't > missed anything like a ) in my code anywhere before that array() > declaration. I've gone over my code several times. According to the > documentation (or my interpretation of it) that array should be correct. > One other thing I'm unsure of that doesn't seem to be covered in the > documentation is referring to variables in an array, like \* "username" => > $username *\ where $username is a variable submitted by an html form via > the post method. Should that work?? And what about referring to a function > in an array such as the following: > > $value = array( > "date" => $date = strftime('%Y-%m-%d') > "title" => $info_title > "dept" => $info_dept > "info" => $info > ); > > Is that valid? Can i just do \* "date" => strftime('%Y-%m-%d') *\ > ?? > > Thanks for your help. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#48229) next »