On Tuesday, April 2, 2002, at 03:27  PM, Philip Olson wrote:

> If you're distributing code in cyberspace it's a good
> idea to make it error free too, E_NOTICE or otherwise.

I got back quite a few responses on this list on the subject of having 
variables that are not defined before they are used.  That's 
interesting -- it's nice to know that I can take shortcuts and conjure 
them up on the fly, but I didn't realize that it was good practice to 
declare the variable before you actually use it in a script.  (I never 
studied programming in any formal sense, as anyone who has seen my 
source code can attest :).

Sometimes I create variables dynamically, such that I could never 
declare/initialize them in any realistic sense -- for instance, I might 
have a while loop that executes a number of times equal to the number of 
rows pulled from a database query.  And in this while loop, I might 
generate a new variable (assigning it a name like $variable$i, using the 
old $i++ trick to give it a unique numeric suffix).

If I use this trick, does this doom me to never having fully-error-free 
code?  Or is there something that I'm not getting here... The short of 
it is that, as a novice programmer, I'd like to make sure I'm writing 
the most legitimate code that I can.  Thanks for any input on this 
thread, past or future.



Erik Price
Web Developer Temp
Media Lab, H.H. Brown

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to