title: Should I use nested if .. else statements for a series of less than comparisons in PHP
body: <p>I need to do a series of comparisons with an integer in PHP, returning a different string depending on the result and I am wondering if an if..else block is the most elegant method. The code looks like:</p>
  
  <pre><code>if( $total &lt; 10000 ) {
    return 'string A';
  } elseif( $total &lt; 20000 ) {
    return 'string B';
  } elseif( $total &lt; 30000 ) {
    return 'string C';
  } elseif( $total &lt; 40000 ) {
    return 'string D';
  } elseif( $total &lt; 50000 ) {
    return 'string E';
  }
  </code></pre>
  
  <p>Which works, I just don't think it's very pretty. If I was doing equality checks then I would use a switch block.</p>