Adding Ordinal Contractions to $i
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3109978/php-display-number-with-ordinal-suffix">php display number with ordinal suffix</a>  </p>
</blockquote>



<p>I'm attempting to add ordinal contractions i.e.(st/nd/rd/th) to an increment.</p>

<p>Somehow I need to get the last digit of $i to test it against my if statements...</p>

<p>Here is my code so far:</p>

<pre><code>    $i = 1;
    while($i &lt; 101 ){

    if($i == 1){$o_c = "st";}else{$o_c = "th";}
    if($i == 2){$o_c = "nd";}
    if($i == 3){$o_c = "rd";}

    echo $i.$o_c."&lt;br/&gt;";
    $i++;

    }
</code></pre>
