Remove warning messages in PHP

Alireza picture Alireza · Jan 1, 2010 · Viewed 578.8k times · Source

I have some PHP code. When I run it, a warning message appears.

How can I remove/suppress/ignore these warning messages?

Answer

Tatu Ulmanen picture Tatu Ulmanen · Jan 1, 2010

You really should fix whatever's causing the warning, but you can control visibility of errors with error_reporting(). To skip warning messages, you could use something like:

error_reporting(E_ERROR | E_PARSE);