PHP does give warnings about undefined array positions if you don't use quotes around them like $array1[var1] will warning (if warnings are on), but $array1["var1"] won't. I have never seen (even with error reporting turned to the maximum setting) PHP throw an error about doing something like: $robot = findRobot(); or whatever without defining "var $robot;" above this, so I'm pretty sure it's ok not to define them, and other then organizationally, it doesn't really serve a purpose since you can't define datatypes (strings, int's, or any other type can go directly into the same $robot).
Adam Voigt [EMAIL PROTECTED] On Tue, 2 Apr 2002 08:30:59 -0600 , Rick Emery <[EMAIL PROTECTED]> wrote: > I've used undefined variables for over 30 years...which has caused many > late-night debugging sessions and much pain. > > Defining and initializing variables is a good thing. I believe PHP has a > flag set to warn of use of un-initialized data. > > I do prefer strongly-typed languages, such as C++. That said, I love the > power that PHP provides as far as functionality is concerned. > > just my 2 pfennigs... > > -----Original Message----- > From: Erik Price [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 8:26 AM > To: Philip Olson > Cc: kip; [EMAIL PROTECTED] > Subject: Re: [PHP] Warning: Undefined variable > > > > On Monday, April 1, 2002, at 11:15 PM, Philip Olson wrote: > > > Good little programmers define variables before > > using them, or at least before evaluating them. > > Really? I'm not arguing with you, I'm curious: I thought that it was a > valued feature of newer scripting languages that they do not require > declaration of variables. At least that's what people say when they > praise PHP or Python or whichever language allows this. > > Is this "feature" not as desirable as what I had first heard? > > > Erik > > > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php