title: Difference between 'die' and 'exit'
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1795025/what-are-the-differences-in-die-and-exit-in-php">what are the differences in die() and exit() in PHP?</a>  </p>
  </blockquote>
  
  
  
  <p>I am totally confused in the difference of <code>die</code> and <code>exit</code>.</p>
  
  <p>Most programmers use <code>die</code> like this.</p>
  
  <pre><code>$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');  //don't see mysql_* problem it is just example
  if (!$link) {
      die('Could not connect: ' . mysql_error());
  }
  </code></pre>
  
  <p>and using <code>exit</code> like this</p>
  
  <pre><code>$filename = '/path/to/data-file';
  $file = fopen($filename, 'r')
     or exit("unable to open file ($filename)");
  </code></pre>
  
  <p>According to there functionality , I don't think so there is any difference because both terminates the execution of the script.</p>
  
  <p>My question is </p>
  
  <blockquote>
    <p>1) Can I interchange die with exit and vice-versa in these examples? </p>
    
    <p>2) And the difference between these also.</p>
  </blockquote>
  
  <p>Cheers...</p>