RE: [PHP] Counter Help

From: Date: Fri, 23 Feb 2001 06:48:40 +0000
Subject: RE: [PHP] Counter Help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41274@lists.php.net to get a copy of this message
Thanks for the great suggestion Simon, I'll definatley keep that in mind. I'm new to PHP, and the counter thing was "copied" off of Weberdev.com. They forgot to add the single quotes around counter. At least this experience helped me learn something new. Again, I thank you for your help and for Chris' help. Navid -----Original Message----- From: Simon Garner [mailto:sgarner@expio.co.nz] Sent: Thursday, February 22, 2001 10:32 PM To: php-general@lists.php.net Subject: Re: [PHP] Counter Help From: "Chris Lee" <lee@mediawaveonline.com> > change > > $row[count] > > to > > $row['count'] > > it thinks the work [count] is some kind of conastant, it doesnt know you > mean (string) 'count' > <rant> I have noticed a lot of people do not put quotes on their array indexes (e.g. VBulletin is a prime offender) - imho this is a really bad practice because your code becomes ambiguous. Example: <?php define("foo", "donkey"); $test = array("foo"=>"orange", "bar"=>"purple"); echo $test[foo]; ?> Now, I think that should print nothing (or an error), because there is no index matching "donkey" (the value of the constant "foo"). But for some reason PHP looks for an array index matching the string "foo" as well, encouraging this kind of sloppy programming. Regards Simon Garner -- 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 (#41274) next »