Stupid Question of the Day

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
caseymanus
Forum Commoner
Posts: 34
Joined: Wed Nov 20, 2002 10:32 pm
Contact:

Stupid Question of the Day

Post 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 ?
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post 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.
User avatar
caseymanus
Forum Commoner
Posts: 34
Joined: Wed Nov 20, 2002 10:32 pm
Contact:

Post by caseymanus »

Thanks dimension....you the man!
Rob the R
Forum Contributor
Posts: 128
Joined: Wed Nov 06, 2002 2:25 pm
Location: Houston

Post 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?
User avatar
caseymanus
Forum Commoner
Posts: 34
Joined: Wed Nov 20, 2002 10:32 pm
Contact:

Post 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?
Rob the R
Forum Contributor
Posts: 128
Joined: Wed Nov 06, 2002 2:25 pm
Location: Houston

Post 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. :?
evilcoder
Forum Contributor
Posts: 345
Joined: Tue Dec 17, 2002 5:37 am
Location: Sydney, Australia

Post by evilcoder »

Of coarse. Dim said it was an error control operator, so that should have been clear...... shouldnt it?
Rob the R
Forum Contributor
Posts: 128
Joined: Wed Nov 06, 2002 2:25 pm
Location: Houston

Post 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. :)
evilcoder
Forum Contributor
Posts: 345
Joined: Tue Dec 17, 2002 5:37 am
Location: Sydney, Australia

Post by evilcoder »

:) well at least you found some joy in it.
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

Post Reply