diff options
author | gxgpet <gxgpet@users.noreply.github.com> | 2016-10-20 11:19:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-20 11:19:48 +0200 |
commit | 7534aa85c2c8a4359f6df0a6f421fb15ca981877 (patch) | |
tree | 78840984bf29c7b04f28471511881311bbef18ee /system/helpers/number_helper.php | |
parent | 4b2b27199025d3c5a6f9b1eee19340c45ec7f2a2 (diff) |
small refactorisations
Diffstat (limited to 'system/helpers/number_helper.php')
-rw-r--r-- | system/helpers/number_helper.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index d7b96c322..e94a5ffbc 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -110,14 +110,24 @@ if ( ! function_exists('ordinal_format')) return FALSE; } - $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'); + $last_digit = array( + 0 => 'th', + 1 => 'st', + 2 => 'nd', + 3 => 'rd', + 4 => 'th', + 5 => 'th', + 6 => 'th', + 7 => 'th', + 8 => 'th', + 9 => 'th'); if ((($number % 100) >= 11) && (($number % 100) <= 13)) { return $number.'th'; } else { - return $number.$ends[$number % 10]; + return $number.$last_digit[$number % 10]; } } } |