title: PHP—"Defined or Exit" at the beginning of many files?
body: <p>I have been inspecting some PHP source codes and I more often than not find files starting with</p>
  
  <pre><code>defined('__someconstant__') or exit();
  </code></pre>
  
  <p>I know that this prevents the file to be accessed directly if a previous file defining <code>__someconstant__</code>, but then I wonder if this is really necessary... Isn't there (even non-PHP based) a cleaner way of doing it without introducing this extra code in every file?</p>