Page 1 of 1

Stupid Question of the Day

Posted: Wed Jan 22, 2003 10:58 am
by caseymanus
in the following code block

Code: Select all

@$result = odbc_exec($db, $sqlstm); 
	if (!$result) { // log errors
		    fputs($log, $line, 3000);}
What does the @ symbol do in front of the variable $result ?

Posted: Wed Jan 22, 2003 11:02 am
by mydimension
it hides all error reporting from that line of code. normally you will see the @ symbol preceeding a function name but it works either way.

Posted: Wed Jan 22, 2003 12:53 pm
by caseymanus
Thanks dimension....you the man!

Posted: Wed Jan 22, 2003 12:59 pm
by Rob the R
I was going to post a link to the relevant section of the PHP manual, but I could not find it. Does anyone know where this is explained in the PHP manual?

Posted: Wed Jan 22, 2003 1:08 pm
by caseymanus
I looked but couldnt find it in the manual. I also looked at my one reference book for PHP...not there either. Maybe an undocumented feature?

Posted: Wed Jan 22, 2003 4:33 pm
by Rob the R
I found the section of the manual this is in. The "@" symbol is actually a unary operator, so it's listed under Error Control Operator. :?

Posted: Wed Jan 22, 2003 4:38 pm
by evilcoder
Of coarse. Dim said it was an error control operator, so that should have been clear...... shouldnt it?

Posted: Wed Jan 22, 2003 4:49 pm
by Rob the R
It would have been clear had he actually said that.
it hides all error reporting from that line of code. normally you will see the @ symbol preceeding a function name but it works either way.
The error reporting section of the PHP manual makes no reference to the "@" sign. That's OK, though. It let me exercise my internet sleuthing skills. :)

Posted: Wed Jan 22, 2003 4:55 pm
by evilcoder
:) well at least you found some joy in it.

Posted: Wed Jan 22, 2003 10:00 pm
by mydimension