Adding number suffixes (st, nd, rd, th, etc.)

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: Adding number suffixes (st, nd, rd, th, etc.)

Post by WiZARD » Sun Jan 12, 2003 5:56 am

You may download Calendar object from PEAR and see at this

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Post by Joan Garnet » Sun Jan 12, 2003 1:47 pm

If you need to determine just up to 12 numbers, then use a simple script:

Code: Select all

switch ($my_number){
     case 1:
         echo $my_number."st";
         break;
     case 2:
         echo $my_number."nd";
         break;
     case 3:
         echo $my_number."rd";
         break;
     default:
         echo $my_number."st";
}

If you need it for larger numbers just tell us.
bye!

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests