Quoting Tris <[EMAIL PROTECTED]>:
Hi all..
when I started PHP (5 years ago.. or maybe 4... I forget) I learnt
that to create a varaiable, I simply wrote:
$variableName = "variableValue";
OR
$variableInt = 3;
All good, it's worked for years..
Buuuuuut....
During myturningon errors today, I was seeing LOADS of undeclared
variable errors..
so I simply added to the top of each page, the problem variable names,
and a blank value.. eg:
$date = "";
$userName = "";
$score = "";
thus declaring them for later use...
Now this strikes me as a pain in the back side..
Can anyone throw lighton to why I need to do this, OR can I fix the
undeclared variables 'bug' without having a list of blank variales at
the top of each page...?
I don't think that you have to do this, I think it's just considered
good practice. In a language that uses strict data typing (C#, C and
Java, I'm looking at you...) then it makes sense to declare them at
the start of the code, however I've always init'd variables as I use
them and I've never had any real issues...
My £0.02,
Matt
--
Matthew Macdonald-Wallace
[EMAIL PROTECTED]
"Sed quis custodiet ipsos custodies?"
____ The WDVL Discussion List from WDVL.COM ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.