title: PHP Checking if Array is empty logic not working
body: <p>I have a page that loads and creates an empty array:</p>
  
  <pre><code>$_SESSION['selectedItemIDs'] = array();
  </code></pre>
  
  <p>If the user hasn't added any selections that get stored in the array I then check the array and branch accordingly, but there appears to be some error in my <code>logic/syntax</code> that is failing here.</p>
  
  <p>Here's where I test if the <code>$_SESSION['selectedItemIDs']</code> is set but <strong>empty:</strong></p>
  
  <pre><code>if (isset($_SESSION['selectedItemIDs']) &amp;&amp; $_SESSION['selectedItemIDs'] !== '') {
      // update the selections in a database
  } else {
      // nothing selection so just record this in a variable
  $selectedItems = 'no selected items were made';
  }
  </code></pre>
  
  <p>When testing this with no selections if I print the <code>$_SESSION['selectedItemIDs']</code> array I get this:</p>
  
  <pre><code>[selectedItemIDs] =&gt; Array
      (
      )
  </code></pre>
  
  <p>however the <code>$selectedItems</code> variable is not being set - it's evaluating the if test as true when I would expect it to be false, but I'm obviously misunderstanding something here.</p>