PHPEdit.net Community
   
1 2 3 4
Tutorials Tips Pasties Code Snippets
 

Home > Pasties > Pastie #5

Created on 23/01/2008 23:12 by LetsSurf

  1. if (!function_exists('ordinal')) {
  2. function ordinal($num) {
  3. if ($num > 13 || $num < 11) {
  4. switch (substr($num, -1)) {
  5. case 1:
  6. return $num.'st';
  7. case 2:
  8. return $num.'nd';
  9. case 3:
  10. return $num.'rd';
  11. }
  12. }
  13. return $num.'th';
  14. }
  15. }

 
PHPEdit User Community, © 2008 WaterProof SARL
Powered by PHPEdit