On Thu, 2002-01-31 at 15:00, Martin Towell wrote: > Is there a way to suppress division by zero errors? > > echo 5/0; // this give a warning - obviously!! > > @echo 5/0; // this gives a parse error > > echo @5/0; // this still comes up with a warning > > unless I turn error_reporting off before and turn it back on afterwards, but > I don't want to do that unless I REALLY have to > > Martin
The @ operator will work on the following expression in this case. In the last one above, you're suppressing the error from the expression '5', since the @ binds more tightly than the / (i.e. @ has a higher precedence). So you need to force precedence, which in PHP is done with parentheses: echo @(5/0); Check the following page for more information: http://www.php.net/manual/en/language.operators.precedence.php Hope this helps, Torben -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]