title: PHP: Wrong evaluation in switch code
body: <p><strong>PREAMBLE: $state can have 3 possible values:</strong></p>
  
  <ul>
  <li>1) <code>0</code> (zero , int) </li>
  <li>2) <code>'Set Level: 10 %'</code> (string) </li>
  <li>3) <code>'Set Level: 20 %'</code>
  (string)</li>
  </ul>
  
  <p>I have a switch code that doesn't return right value.</p>
  
  <p>This is the code:</p>
  
  <pre><code>&lt;?php
  
  $state = 0;
  
  switch ($state) {
  
              case 'Set Level: 10 %':
  
                  $return = 1;
  
              break;
  
              case 'Set Level: 20 %':
  
                  $return = 2;
  
              break;
  
              default:
  
                  $return = 0;
  
              break;
  
          }
  
          echo 'return:';
  
          var_dump($return);
  </code></pre>
  
  <p>And this is the fiddle: <a href="https://3v4l.org/IQ142" rel="nofollow noreferrer">https://3v4l.org/IQ142</a></p>
  
  <p>With <code>$state = 0</code> it returns <code>1</code> and not <code>0</code>, as default. I did try also to remove default and impose case 0: but no change.</p>
  
  <p>Thank you</p>
  
  <p>NOTICE: <code>$state</code> could be also as string. For this I need to check for string.</p>