title: Turn off or handle errors within a production environment?
body: <p>After having an argument with my team because we all have different views on this sort of situation.. When is it actually acceptable to turn off PHP error messages, or to suppress some functions which are throwing warnings, notices for whatever reason..</p>
  
  <p>I understand everyone says that you should turn off error_reporting within a production environment, but that might cause some complications which will not be picked up.. So nothing will get fixed, furthermore. PHP comes with many different methods to control error messages.. For example: </p>
  
  <pre><code>$Var = "Variable Is Set";
  
  if (@$Var){ echo $Var; }
  </code></pre>
  
  <p>Over: </p>
  
  <pre><code>if (isset($Var)){ echo $Var; }
  </code></pre>
  
  <p>Because we have a set variable, this will sucessfully echo.. Whereas if we didn't have a set variable, this would throw a notice.. So Which one to use? The isset or error suppression? </p>
  
  <p>And within a production environment, which one would be more acceptable to use? </p>
  
  <pre><code>error_reporting(0);
  </code></pre>
  
  <p>The above will turn off all types of PHP error reporting, giving no error messages even if something is encountered. So in some cases this could lead to broken code that stops working for an unknown reason, due to the message being destroyed </p>
  
  <p>or: </p>
  
  <pre><code>set_error_handler("");
  </code></pre>
  
  <p>The above enables a custom error handler, which can be used to gracefully show a error to the user, and enable administration to log the detailed warning.. But then again, the error_handler to my knowledge will not be called when a fatal error is triggered? </p>
  
  <p>So My overall question?</p>
  
  <p>Handle errors in production environment or just turn them off in general? This boils down to best practices and preferences I guess.. But it's something that is puzzling me and my team to the point of disagreements. </p>