Skip to content

Instantly share code, notes, and snippets.

@benjaminrau
Created June 7, 2013 11:51
Show Gist options
  • Save benjaminrau/5728739 to your computer and use it in GitHub Desktop.
Save benjaminrau/5728739 to your computer and use it in GitHub Desktop.
Frame the genitive of a name
function genitive($name) {
$suffix = 's';
$name = trim($name);
if('ce' == substr($name, -2)) {
$suffix = '’';
}
elseif (in_array(substr($name, -1), array('s', 'ß', 'x', 'z'))) {
$suffix = '’';
}
return $name.$suffix;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment