title: Skip keys in array without values in a foreach loop
body: <p>I have a normal one dimensional array, let's call it <strong>$myarray</strong>, with several keys ranging from [0] to [34]. Some keys could be empty though. </p>
  
  <p>Suppose I want to use such array in a foreach loop</p>
  
  <pre><code> $i = 1;
   $choices = array(array('text' =&gt; ' ', 'value' =&gt; ' '));
   foreach ( $myarray as $item ) :
        $count = $i++; 
        $choices[] = array('text' =&gt; $count, 'value' =&gt; $count, 'price' =&gt; $item);
   endforeach;
  </code></pre>
  
  <p>I'd wish to skip in this foreach loop all the empty keys, therefore the other array I'm building here (<strong>$choices</strong>) could have a smaller amount of rows than <strong>$myarray</strong>. At the same time, though, as you see, I count the loops because I need an increasing number as value of one of the keys of the new array being built. The count should be progressive (1..2..3..4...).</p>
  
  <p>thanks</p>