title: PHP - run code only on successful switch
body: <p>Looking for an easier way to accomplish:</p>
  
  <pre><code>$switch_success = false;
  switch ($var){
      case "a":
          // do some stuff
          $switch_success = true;
          break;
      case "b":
          // do some stuff
          $switch_success = true;
          break;
      case "c":
          // do some stuff
          $switch_success = true;
          break;
  }
  if ($switch_success){
      // switch was successful - run once only if switch finds a matching case
  }
  </code></pre>
  
  <p>Maybe another case keyword like <code>default</code> only for <code>any</code> or <code>all</code>:</p>
  
  <pre><code>case "c":
      // do some stuff
      break;
  all:
      // switch was successful - run once only if switch finds a matching case
  </code></pre>
  
  <p>Or maybe ...</p>
  
  <pre><code>$switch_success = switch ($var){
      case "a":
      // do some stuff
      break;
      case "b":
      // do some stuff
      break;
      case "c":
      // do some stuff
      break;
  }
  if ($switch_success) //... 
  </code></pre>
  
  <p>Just tried that to no avail, but just trying to illustrate my intent.</p>