title: PHP: die or check results?
body: <p>I am implementing LDAP with PHP which is going fairly easily I must say. However I have a question regarding the use of <code>die()</code> or checking function returns. From the below code (<a href="http://www.php.net/manual/en/function.ldap-bind.php" rel="nofollow">taken from here</a>), what is the point of checking for <code>$ldapconn</code> if you use <code>die()</code> with the <code>ldap_connect</code>? Isn't PHP supposed to exit with <code>die()</code> if something goes wrong with <code>ldap_connect</code> anyway?</p>
  
  <pre><code>// connect to ldap server
  $ldapconn = ldap_connect("ldap.example.com")
      or die("Could not connect to LDAP server.");
  
  if ($ldapconn) {
  
      // binding to ldap server
      $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
  
      // verify binding
      if ($ldapbind) {
          echo "LDAP bind successful...";
      } else {
          echo "LDAP bind failed...";
      }
  
  }
  </code></pre>