feat: more work on completing switchover
This commit is contained in:
27
site/app/Helpers/pcagHelpers.php
Normal file
27
site/app/Helpers/pcagHelpers.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('numberSuffix')) {
|
||||
function numberSuffix($number) {
|
||||
if (!is_int($number) || $number < 1) {
|
||||
return $number;
|
||||
}
|
||||
|
||||
$lastDigit = $number % 10;
|
||||
$secondLastDigit = ($number / 10) % 10;
|
||||
|
||||
if ($secondLastDigit == 1) {
|
||||
return 'th';
|
||||
}
|
||||
|
||||
switch ($lastDigit) {
|
||||
case 1:
|
||||
return 'st';
|
||||
case 2:
|
||||
return 'nd';
|
||||
case 3:
|
||||
return 'rd';
|
||||
default:
|
||||
return 'th';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user