title: Break first loop and continue next loop if true
body: <p>I have a <code>foreach</code> loop inside another <code>foreach</code> loop as this code:</p>
  
  <pre><code>foreach($array1 as $uid =&gt; $somevalues) {
  
    $status = true;
    foreach($somevalues as $somevalue)
      if(!isset($somevalue-&gt;$someothervalue))
        $status = false;
  
    if($status) {
      $content .= "some content added";
      $count++;
    }
  }
  </code></pre>
  
  <p><strong>How it works</strong></p>
  
  <p>As you see I am looping through all entries in <code>$array1</code>. For each entry I loop through the contained <code>$somevalues</code> array to look for a certain condition (that <code>$someothervalue</code> exists there). Now, if this condition (that something <code>isset</code>) is not true then the <code>$status</code> changes to <code>false</code>.</p>
  
  <p>Only if the <code>$status</code> is still true after all loops of the inner <code>foreach</code>, I wish some action to be made (some content added to a text string <code>$content</code> and a raised counter).</p>
  
  <p><strong>The goal</strong></p>
  
  <p>The arrays I'm working with can be quite large and I have been looking at the <code>break</code> and <code>continue</code> commands to try to skip unnecessary parts to improve the code and have the script running through fewer loops.</p>
  
  <p>As you can see, if a loop from the inner <code>foreach</code> results in <code>$status=false</code> then we can stop it right there (no further loops here are necessary). The <code>break</code> is good for this to skip the rest of the <code>forearch</code> loops.</p>
  
  <p>If this is the case then we can also skip the rest of the current outer loop from the outer <code>foreach</code>, since there will not be run any code now that <code>$status</code> is <code>false</code>. For this purpose the <code>continue</code> command would be useful to let us skip the rest of the current outer loop and go on to the next array row right away.</p>
  
  <p><strong>The question</strong></p>
  
  <p>I have been looking at the command lines <code>break 2</code> and <code>continue 2</code> e.g. that let you skip the current AND the outer loop (two steps up) with their respective results (either stopping the loop entirely or skipping the rest of current loop). They work as double break - as a "<code>break break</code>" - and as double continue - as a "<code>continue continue</code>" - respectively.</p>
  
  <p>But here I need something like <code>break continue</code> instead, if you get my point. The first loop should <code>break</code>, the next should <code>continue</code>. I am trying to avoid reaching the <code>if</code> statement in the code if not necessary. The check is already made and it feels like doing an unnecessary double check.</p>
  
  <p>I hope the question is clear. Is there a method for this purpose to double skip from within the inner <code>foreach</code> but with the effect of two different commands <code>break continue</code>?</p>