title: PHP: Formatting the day number suffix in php with date()
body: <p>I feel a bit silly for this one, but is there a <em>more elegant way to format the day number suffix</em> (st, th) other than by having to call the date() 3 times?</p>
  
  <p>What I am trying to output in html:</p>
  
  <pre><code>&lt;p&gt;January, 1&lt;sup&gt;st&lt;/sup&gt;, 2011&lt;/p&gt;
  </code></pre>
  
  <p>What I am doing now (feels very heavy) in php:</p>
  
  <pre><code>//I am omitting the &lt;p&gt; tags:
  echo date('M j',$timestamp)  
  . '&lt;sup&gt;' . date('S', $timestamp) . '&lt;/sup&gt;'  
  . date(' Y', $timestamp);
  </code></pre>
  
  <p>Anyone knows a better way?</p>