Ask about general coding issues or problems here.
Moderators: macek, egami, gesf
Is there a cool slick way to determine which suffix goes at the end of a number (1st, 2nd, 3rd, 25th, etc.) besides a dozen if then statements after counting the char length of the number and subtracting all but the last digit to determine the final one, then adding the approriate suffix?
It seems like I should be able to take it's modulus by 10 to determine the last digit. Then (unless the number is between 6 and 20; which all take a 'th'). adding the suffix based on the modulus result.
- New php-forum User
- Posts: 3
- Joined: Wed Oct 30, 2002 9:15 am
You may download Calendar object from PEAR and see at this
- Posts: 1257
- Joined: Thu Jun 20, 2002 10:14 pm
- Location: Ukraine, Crimea, Simferopol
If you need to determine just up to 12 numbers, then use a simple script:
- Code: Select all
If you need it for larger numbers just tell us.
- Posts: 387
- Joined: Sat Aug 03, 2002 2:56 am
- Location: Mars
Return to PHP coding => General
Who is online
Users browsing this forum: Yahoo [Bot] and 2 guests