TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 05-08-2008, 07:07 PM   #1 (permalink)
The Wanderer
 
Join Date: May 2008
Posts: 5
Thanks: 3
JabberGabber is on a distinguished road
Default What's @ doc ?

Hi

In some code examples I have seen some functions have been preceded with the @ symbol:

$image = @imagecreatefromjpeg('image.jpg');

What's all that about then ??

Thanks in advance

JabberGabber
JabberGabber is offline  
Reply With Quote
Old 05-08-2008, 08:53 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,381
Thanks: 5
Salathe is on a distinguished road
Default

The @ symbol is an error control operator, it suppresses the display of any error messages which might occur. Full details can be found on the PHP manual page Error Control Operators.
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
JabberGabber (05-08-2008)
Old 05-08-2008, 09:20 PM   #3 (permalink)
The Wanderer
 
Join Date: May 2008
Posts: 5
Thanks: 3
JabberGabber is on a distinguished road
Default

Excellent - thanks for that.
JabberGabber is offline  
Reply With Quote
Old 05-12-2008, 09:20 PM   #4 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

Exactly! It is very useful especially when certain conditions may exist.

For instance, if you expect an error to occur out of a function (XML Parsing comes to mind and being fed bad data), or if an error could potentially occur, but you want it to fail silently and continue on IE database connections. Should a database connection occur and you supress it correctly, instead of getting the default could not connect message, you can make it all pretty and stuff with a custom error handler, or use the OR DIE() function... but thats another topic
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 03:20 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design