title: php defined constant in if/else shorthand
body: <p>I've been working on a php course, and one of the exercises has us create a config.php file wherein we define database constants.</p>
  
  <p>I know the standard way of doing this, which is:</p>
  
  <pre><code>define("NAME", "value");
  </code></pre>
  
  <p>However, this exercise has it written differently. It's in if/else shorthand. 
  Now I know it's correct, because it works. 
  But I don't understand <em>WHY</em> it works. 
  Hopefully it's a simple answer for you more experienced devs:</p>
  
  <pre><code>defined('DB_SERVER') ? null : define('DB_SERVER', 'localhost');
  </code></pre>
  
  <p>The way I read it, it's checking to see if DB_SERVER is defined. 
  If it's true, then it sets it to NULL ?</p>
  
  <p>Why would it NULL out the value of that constant if it's already defined?</p>