title: PHP: Check if array key has value
body: <p>I have the following array(<code>$post_options</code>), it can appear in various guises, the key is dynamic:</p>
  
  <p>It might be like this:</p>
  
  <blockquote>
    <p>array(1) { [95]=> string(2) "25" }</p>
  </blockquote>
  
  <p>It might be like this, the key can be anything:</p>
  
  <blockquote>
    <p>array(1) { [05]=> string(2) "" }</p>
  </blockquote>
  
  <p>I want to add a control statement that controls upon whether or not the value in the first key element has a value. </p>
  
  <p>I have this code:</p>
  
  <pre><code>if (!isset($post_options[0])) {
              // value is empty
              var_dump($post_options);
          }
          else {
              // value has value
              echo 'Option Selected';
          }
  </code></pre>
  
  <p>But this is not working, it returns true when the value is set and not set. What is the solution here? Thanks</p>
  
  <p>So if the array appears like this (the value of the first key is empty): </p>
  
  <blockquote>
    <p>array(1) { [05]=> string(2) "" }</p>
  </blockquote>
  
  <p>I want to <code>var_dump();</code> in this case</p>