2009/4/7 Chris <dmag...@gmail.com>:
> 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') {
    ini_set('display_errors', true);
} else {
   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...
Trade - Expand - Fight

Follow me on twitter!

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to