onetone_CountTail

The Onetone onetone CountTail function.

Description

onetone_CountTail( (number) $number ); 

Parameters (1)

0. $number (number)
The number.

Usage

  1. if ( !function_exists( 'onetone_CountTail' ) ) { 
  2. require_once '/includes/admin-options.php'; 
  3.  
  4. // The number. 
  5. $number = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = onetone_CountTail($number); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/admin-options.php  
  1. function onetone_CountTail($number)  
  2. {  
  3. $nstring = (string) $number;  
  4. $pointer = strlen($nstring) - 1;  
  5. $digit = $nstring[$pointer];  
  6. $suffix = "th";  
  7.  
  8. if ($pointer == 0 ||  
  9. ($pointer > 0 && $nstring[$pointer - 1] != 1))  
  10. {  
  11. switch ($nstring[$pointer])  
  12. {  
  13. case 1: $suffix = "st"; break;  
  14. case 2: $suffix = "nd"; break;  
  15. case 3: $suffix = "rd"; break;  
  16. }  
  17. }  
  18.  
  19. return $number . $suffix;  
  20. }