Whats the @ sign?

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
[n00b]
Forum Commoner
Posts: 34
Joined: Sat Mar 20, 2004 7:06 pm

Whats the @ sign?

Post by [n00b] »

I see the @ sign frequently at the beginning of function or variable names. None of my ebooks mention it. Whats that? :x

Thanks
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

supresses errors - not exactly good form!
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

yeah, the @ symbol confused me for a while too.

i still dont bother using it
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

it's good if you use a function or something, which isn't important...
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

yea but its still not Good. Its useful, but I would never recommend it...
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

There's ways around it, like file_exists and function_exists. Sometimes I'll use it though.
dave420
Forum Contributor
Posts: 106
Joined: Tue Feb 17, 2004 8:03 am

Post by dave420 »

There aren't generic ways round it, just a couple of functions that can help in very specific circumstances. PHP5 is supposed to address this problem, allowing us to use java-style try {} catch () syntax, which is what this whole @-thing is trying to do :)

It's not the best, but it's sometimes the only way round a poorly-coded function that craps out when conditions aren't 100% as expected.

It's nowhere near as evil as eval(). That's the most evil function in existance. :)
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

dave420 wrote: It's nowhere near as evil as eval(). That's the most evil function in existance. :)
But useful anyway ;) For quick hacks ;)
Post Reply