title: PHP: do this || that (like javascript)
body: <p>In javascript we can use <code>||</code> to perform a second action if the first one fails, like:</p>
  
  <pre><code>function getObject(id_or_object) {
      var obj = document.getElementById(id_or_object) || id_or_object;
      return obj;
  }
  </code></pre>
  
  <p>How can we do this in PHP?</p>
  
  <p>If we can't, I can swear I have seen this <code>||</code> used like this in PHP. What does it mean?</p>
  
  <p>I want to do:</p>
  
  <pre><code>function fix_item($item) {
      $item['armor'] = $item['armor'] || 0;
      return $item;
  }
  </code></pre>
  
  <p>But this doesn't work, so I'm using</p>
  
  <pre><code>function fix_item($item) {
      if (!isset($item['armor'])) $item['armor'] = 0;
      return $item;
  }
  </code></pre>
  
  <p>, but I don't like the second method.. Any ideas?</p>