Error suppression
By putting the @ in front of a function an error can be supressed that would be printed by PHP. The common error the Wrox team points out is the division by zero that can occur. I usually make code which will compare the value of the code rather than suppress the error. Let's take the following example below:
$number = 0;
$average = 3 / $number;
print($average);
Line 3 above will result in a division by zero error. The error will not be shown if you put a @ in front of the third line like this:
@print($average);
I would probably write the code above like this, however:
$number = 0;
if ($number > 0) { $average = 3 / $number; }
print($average);
I guess rather than suppressing error message I'd rather write code that makes sure there is no possibility of an error, but the error suppression tip is useful.
MiniMitt wrote:
Is it possible to ignore the division by zero warning on a page. Basicly I know its there and its ok to be there but I dont want that particular error printing on the screen.
Can I somehow make it not print that?