Strudel before function

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I basically know that when you call a function like @foo(bar), you are
supressing error messages.

But I have never found out how to *really* use it. Most of the error
messages I get mean that I have to fix something right now once and
for all. Supressing an error message doesn't supress the error. And
this little strudel doesn't seem to do anything useful for me.

So maybe I need to learn something. But I can't find anything in the
PHP docs in regards to it.

Anybody can point me to some useful information on it?

Re: Strudel before function

Quoted text here. Click to load it

How about here:

Hope that helps,

Re: Strudel before function

Razzbar wrote:
Quoted text here. Click to load it

There's loads of times user given data can be valid or invalid. While it  
  can create an error, and you normally want to display and/or log  
errors,   it can be that a certain action can fail, and you're not  
really interested in the error, as it's an error for your user to figure  
out, not you.

An example:
For instance, let's say you want to validate the html-code of an url  
given to you by the user. Now, the user (accidentally or not) inputs the  
wrong url. Let's say you use fopen(); to open the url and get the  
contents. Fopen() will generate an error because the url doesn't exist.  
This is not your concern however (offcourse you'll have a check that  
informs the user your script cannot open the url). Not being able to  
open a non-existent url is not something you're interested in, so you  
don't want the generated php-error turning up on screen (actually, you  
never want that on live servers), and not in your log files. Hence the @.

Well, that's how it could be. Some coders are just sloppy and overly use  
@ just to hide the fact that they cannot write a decent piece of code,  
and on top of that don't know how to disable error_reporting(). So, I'm  
very pleased to so you write "Supressing an error message doesn't  
supress the error. And this little strudel doesn't seem to do anything  
useful for me."  The @ error-supressor has seldom any real use indeed.

Rik Wasmus

Estimated date being able to walk again: 01-05-2007.
Less then a week, hurray!

Site Timeline