public static function singlelise($string)
    {
        $rules = [
            'ies' => 'y',
            'ves' => 'f',
            's'   => '',
        ];

        foreach ($rules as $ending => $replacement) {
            if ($ending === substr($string, -strlen($ending))) {
                return substr($string, 0, -strlen($ending)) . $replacement;
            }
        }

        return $string . 'Single';
    }
public static function singlelise($string)
    {
        $rules = [
            'ies' => 'y',
            'ves' => 'f',
            's'   => '',
        ];

        foreach ($rules as $ending => $replacement) {
            if ($ending === substr($string, -strlen($ending))) {
                return substr($string, 0, -strlen($ending)) . $replacement;
            }
        }

        return $string . 'Single';
    }
public static function singlelise ( $ string ) { $ rules = [ 'ies' => 'y' , 'ves' => 'f' , 's' => '' , ] ; foreach ( $ rules as $ ending => $ replacement ) { if ( $ ending === substr ( $ string , - strlen ( $ ending ) ) ) { return substr ( $ string , 0 , - strlen ( $ ending ) ) . $ replacement ; } } return $ string . 'Single' ; }
Get the plural name from a singular

@param string $string

@return string
Get the plural name from a singular