I just recently found that most of the errors I've been getting have to do with the fact that after PHP was installed on my host's server, no one changed it from the default development error levels. I asked my host to change it, and I think he may have set it too low- what does everyone have for their error level? What's the best recommendation for someone who is just getting beyond the beginnings of PHP?
-ben
error level
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
thanks for the help. i actually just discovered error logging to a txt file, as well as setting the error level, while reading my PHP book on the way back from class today.
my main concern is that the book i've been learning from (peachpit press, i've always had good luck with them. probably won't buy a coding book from them again, though) uses a method of "testing" to see if a variable is live by merely going:
obviously this kept popping up warnings. isset() is probably the best for this, but is there any actual downside to using the above method besides the obvious warnings showing up?
-ben
my main concern is that the book i've been learning from (peachpit press, i've always had good luck with them. probably won't buy a coding book from them again, though) uses a method of "testing" to see if a variable is live by merely going:
Code: Select all
if ($variable){
do this;
and this;
}-ben
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Definitely, the other method shouldn't be used unless you are testing to see if a variable has a value of true or false.wallabee wrote:isset() is probably the best for this
The warnings are the downside, isset() or empty() won't give you errors.wallabee wrote:but is there any actual downside to using the above method besides the obvious warnings showing up?
<moan>It's unfortunate that the authors of a number of books never set their error reporting higher than the old defaults otherwise they might have done the coding properly.</moan>
Mac
you toss this idea that they didn't take into consideration E_ALL, in with the fact that they advertise PHP4, though don't use $_GET['var'], and instead just assume $var, and you've got a very confused novice at PHP trying to learn a book that's going to give him errors anyway.
i came out somewhat fine.
i came out somewhat fine.
That's a point.twigletmac wrote:<moan>It's unfortunate that the authors of a number of books never set their error reporting higher than the old defaults otherwise they might have done the coding properly.</moan>
Errorhandle'ing is a great part of a good source.
I have a script before my all php (du to a config), and all error's are mailed to me. If whe devolep a program, whe have a var $DEBUG set to TRUE, and then all error's are reported to the screen instead of mail.
A client 'never' gets to see a error. And if one happens to sneak by, whe solved it before the client call's us.