title: PHP Error handling: die() Vs trigger_error() Vs throw Exception
body: <p>In regards to Error handling in PHP -- As far I know there are 3 styles:</p>
  
  <ol>
  <li><p><code>die()</code>or <code>exit()</code> style:</p>
  
  <pre><code>$con = mysql_connect("localhost","root","password");
  
  if (!$con) {
   die('Could not connect: ' . mysql_error());
  }
  </code></pre></li>
  <li><p><code>throw Exception</code> style:</p>
  
  <pre><code> if (!function_exists('curl_init')) {
  
        throw new Exception('need the CURL PHP extension. 
                             Recomplie PHP with curl');
      }
  </code></pre></li>
  <li><p><code>trigger_error()</code> style:</p>
  
  <pre><code>if(!is_array($config) &amp;&amp; isset($config)) {
          trigger_error('Error: config is not an array or is not set', E_USER_ERROR);
      }
  </code></pre></li>
  </ol>
  
  <p>Now, in the PHP manual all three methods are used. </p>
  
  <ul>
  <li><p>What I want to know is which style should I prefer &amp; why?</p></li>
  <li><p>Are these 3 drop in replacements of each other &amp; therefore can be used interchangeably?</p></li>
  </ul>
  
  <p>Slightly OT: Is it just me or everyone thinks PHP error handling options are just <em>too many</em> to the extent it confuses php developers?</p>