title: Foreach an array to check if the value of a key is not empty
body: <p>I have an array that goes like this</p>
  
  <pre><code>$array = array('key1' =&gt; $_GET['value1'], 'key2' =&gt; $_GET['value2']);
  </code></pre>
  
  <p>I want to check if the key's value is not empty. Say a user goes to the webpage and requests this
  <a href="http://mysite.com/page.php?value1=somevalue&amp;value2=" rel="nofollow">http://mysite.com/page.php?value1=somevalue&amp;value2=</a> which means that value2 is empty or say that it is missing from the query string i want to be able to check if it's there and is not empty.</p>
  
  <p>I tried this</p>
  
  <pre><code>foreach($array as $key =&gt; $value)
  {
      if(empty($value))
      {
          //spout some error
      }
  }
  </code></pre>
  
  <p>but even though i enter this <a href="http://mysite.com/page.php?value1=somevalue" rel="nofollow">http://mysite.com/page.php?value1=somevalue</a> meaning that value2 is missing, i don't get the error.</p>
  
  <p>How do i achieve what i want?</p>