Skip to content

Instantly share code, notes, and snippets.

@fuggla
Last active November 25, 2016 10:40
Show Gist options
  • Save fuggla/449e389f2efecb0d8acaabf0a27e7510 to your computer and use it in GitHub Desktop.
Save fuggla/449e389f2efecb0d8acaabf0a27e7510 to your computer and use it in GitHub Desktop.
return number with swedish ordinal
<?php
/**
* Return swedish ordinal
* eg 1:a or 19:e
* Not needed if this is available: http://www.php.net/manual/en/class.numberformatter.php
**/
function theme_slug_swedish_ordinal($number) {
$last = substr($number, -1);
if ($last <= 2)
return $number . ':a';
else
return $number . ':e';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment