2009/4/7 Chris <dmagick@xxxxxxxxx>: > Igor Escobar wrote: >> >> Becarefull, error supression is slow. > > If it's the only way to stop an error from showing up, what's the problem? > > php will still generate the warning/notice even if display_errors is > disabled - which will be even slower. > > Plus I never said use it everywhere, I said use it in particular cases and > comment your code about why you had to use it. > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > @phpfunction does just the same thing. Basically it's a shortcut to set display_errors to off before the function call and switch it back on after the function call. This is why it is slow. Some better practices would be: Just turn display_errors to off in you php.ini on the production system, if you can. Use ini_set('display_errors', false); in a central include file that gets included into every file. If you want to use the same script on development and production system you can add a SetEnv Directive inside you apache. Something like SetEnv SERVER_ROLE development Should do. Then you can do the following: if($HTTP_ENV_VARS['SERVER_ROLE'] == 'development') { error_reporting(E_ALL); ini_set('display_errors', true); } else { error_reporting(0); ini_set('display_errors', false); } So your code will work on production and on development server. Feel free to ask if you need further help. -- Currently developing a browsergame... http://www.p-game.de Trade - Expand - Fight Follow me on twitter! http://twitter.com/moortier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php