NO!!! The error control operator should be used only when doing custom
error control!
For instance, say I want to include a file, but it doesn't exist on the
system.
<?php include 'file.php'; ?>
That will spit out a warning (cannot open stream). This is something
you want to know about! Obviously, there is a reason why I wanted the
file in the first place. Don't suppress the warning, or you may never
know what is wrong.
However, you may want to do something more elaborate:
<?php
if( !@include 'file.php' ){
// file doesn't exist, call a user function
file_doesnt_exist('file.php',__FILE,__LINE__);
}
?>
Here, the error is suppressed, but it was intentional. The
file_doesnt_exist function might send the webmaster an email or do some
other helpful procedure.
I swear, if I get another project to take over/maintain that has blocks
like this:
<?php
$rowcount = mysql_num_rows($result);
if($rowcount > 0)
{
$row = mysql_fetch_array($result);
@ $securityquestion = $row['securityquestion'];
@ $securityanswer = $row['securityanswer'];
@ $company = $row['company'];
@ $title = $row['title'];
@ $division = $row['division'];
@ $firstname = $row['firstname'];
@ $lastname = $row['lastname'];
@ $emailaddr1 = $row['emailaddr1'];
@ $emailaddr2 = $row['emailaddr2'];
@ $website = $row['website'];
@ $phone1 = $row['phone1'];
@ $phone2 = $row['phone2'];
@ $phone3 = $row['phone3'];
@ $address1 = $row['address1'];
@ $address2 = $row['address2'];
@ $city = $row['city'];
@ $state = $row['state'];
@ $zip = $row['zip'];
$uts=$row['updatetimestamp'];
@ $updateuserid=$row['updateuserid'];
$hour = substr($uts,8,2);
$ampm = " AM";
if($hour > 12)
{
$hour = $hour - 12;
$ampm = " PM";
}
@ $updatetimestamp = substr($uts,4,2)."/".
substr($uts,6,2)."/".
substr($uts,0,4)."@".
$hour.":".substr($uts,10,2).$ampm;
@ $lastupdated = " - last updated by {$updateuserid} on
{$updatetimestamp}";
}
?>
I'm going to go POSTAL!!!
(Since I dug that snippet out, I just had to submit it to
http://www.thephpwtf.com/ !)