[eluser]Jonathon Hill[/eluser]
I was using the inflect() function to pluralize "day" and got "daies." Yuck!
The bug actually exists in
plural(). Here's a fix:
Code:
function plural($str, $force = FALSE)
{
$str = strtolower(trim($str));
$end = substr($str, -1);
if ($end == 'y')
{
$dipthongs = array('ay', 'ey', 'iy', 'oy', 'uy');
$str = (!in_array(substr($str, -2), $dipthongs))? substr($str, 0, strlen($str)-1).'ies' : $str .= 's';
}
elseif ($end == 's')
{
if ($force == TRUE)
{
$str .= 'es';
}
}
else
{
$str .= 's';
}
return $str;
}
Plural of "boy" is "boys", not "boies".
Plural of "ray" is "rays", not "raies".
Are there other dipthongs we need to make exceptions for besides "ay" and "oy"?