Welcome Guest, Not a member yet? Register   Sign In
Inflector bug fix in singular()

Currently, singular() results in the following:

horses -> hors
bases -> bas

I recommend the following code change in the singular() function:

$last3 = substr($str, -3);
$last4 = substr($str, -4);

if ($last3 == 'ies')
elseif ($last4 == 'sses')

Those few line changes fix the singular() function.

welcome to CI CaptSaltyJack -

it's always good to come out of the gate with a bug fix! nicely done.


squashing inflector bugs is like stepping on roaches... if you see one, that just means that there are 500 more in the wall and the one you saw got claustrophobia.

i suggest that you look at these threads (one has a wiki page: "inflector" - the regex he uses there is a work of art, it's really worth a peek):



Ahh I see I'm not the first to notice this Smile I'll defer to the more comprehensive solutions. Thanks!

Theme © iAndrew 2016 - Forum software by © MyBB