Hi,
for ($rank=0; $rank<100; $rank++)
{
printf("Your rank: %d%s", $rank, $suffix);
}
Is there exist a gettext function to localize $suffix in the general case (any language)?
Thank you.
Hi,
for ($rank=0; $rank<100; $rank++)
{
printf("Your rank: %d%s", $rank, $suffix);
}
Is there exist a gettext function to localize $suffix in the general case (any language)?
Thank you.
Not that I know of, but you can use NumberFormatter
$nf = new NumberFormatter('en_US', NumberFormatter::ORDINAL);
print $nf->format(123); // prints 123rd
Source: