src/Cuztom.php
public static function pluralize($string)
    {
        $specials = apply_filters('cuztom_plural', [
            ['/(quiz)$/i',               '$1zes'],
            ['/^(ox)$/i',                '$1en'],
            ['/([m|l])ouse$/i',          '$1ice'],
            ['/(matr|vert|ind)ix|ex$/i', '$1ices'],
            ['/(x|ch|ss|sh)$/i',         '$1es'],
            ['/([^aeiouy]|qu)y$/i',      '$1ies'],
            ['/([^aeiouy]|qu)ies$/i',    '$1y'],
            ['/(hive)$/i',               '$1s'],
            ['/(?:([^f])fe|([lr])f)$/i', '$1$2ves'],
            ['/sis$/i',                  'ses'],
            ['/([ti])um$/i',             '$1a'],
            ['/(buffal|tomat)o$/i',      '$1oes'],
            ['/(bu)s$/i',                '$1ses'],
            ['/(alias|status)$/i',       '$1es'],
            ['/(octop|vir)us$/i',        '$1i'],
            ['/(ax|test)is$/i',          '$1es'],
            ['/s$/i',                    's'],
            ['/$/',                      's'],
        ]);

        $irregular = apply_filters('cuztom_irregular', [
            ['move',   'moves'],
            ['sex',    'sexes'],
            ['child',  'children'],
            ['man',    'men'],
            ['person', 'people'],
        ]);

        $uncountable = apply_filters('cuztom_uncountable', [
            'sheep',
            'fish',
            'series',
            'species',
            'money',
            'rice',
            'information',
            'equipment',
            'pokemon',
        ]);

        // Save time if string in uncountable
        if (in_array(strtolower($string), $uncountable)) {
            return apply_filters('cuztom_pluralize', $string, 'uncountable');
        }

        // Check for irregular words
        foreach ($irregular as $noun) {
            if (strtolower($string) == $noun[0]) {
                return apply_filters('cuztom_pluralize', ucwords($noun[1]), 'irregular');
            }
        }

        // Check for plural forms
        foreach ($specials as $pattern) {
            if (preg_match($pattern[0], $string)) {
                return apply_filters(
                    'cuztom_pluralize',
                    ucwords(preg_replace($pattern[0], $pattern[1], $string)),
                    'special'
                );
            }
        }

        // Return if noting found
        return apply_filters('cuztom_pluralize', $string, null);
    }
public static function pluralize($string)
    {
        $specials = apply_filters('cuztom_plural', [
            ['/(quiz)$/i',               '$1zes'],
            ['/^(ox)$/i',                '$1en'],
            ['/([m|l])ouse$/i',          '$1ice'],
            ['/(matr|vert|ind)ix|ex$/i', '$1ices'],
            ['/(x|ch|ss|sh)$/i',         '$1es'],
            ['/([^aeiouy]|qu)y$/i',      '$1ies'],
            ['/([^aeiouy]|qu)ies$/i',    '$1y'],
            ['/(hive)$/i',               '$1s'],
            ['/(?:([^f])fe|([lr])f)$/i', '$1$2ves'],
            ['/sis$/i',                  'ses'],
            ['/([ti])um$/i',             '$1a'],
            ['/(buffal|tomat)o$/i',      '$1oes'],
            ['/(bu)s$/i',                '$1ses'],
            ['/(alias|status)$/i',       '$1es'],
            ['/(octop|vir)us$/i',        '$1i'],
            ['/(ax|test)is$/i',          '$1es'],
            ['/s$/i',                    's'],
            ['/$/',                      's'],
        ]);

        $irregular = apply_filters('cuztom_irregular', [
            ['move',   'moves'],
            ['sex',    'sexes'],
            ['child',  'children'],
            ['man',    'men'],
            ['person', 'people'],
        ]);

        $uncountable = apply_filters('cuztom_uncountable', [
            'sheep',
            'fish',
            'series',
            'species',
            'money',
            'rice',
            'information',
            'equipment',
            'pokemon',
        ]);

        // Save time if string in uncountable
        if (in_array(strtolower($string), $uncountable)) {
            return apply_filters('cuztom_pluralize', $string, 'uncountable');
        }

        // Check for irregular words
        foreach ($irregular as $noun) {
            if (strtolower($string) == $noun[0]) {
                return apply_filters('cuztom_pluralize', ucwords($noun[1]), 'irregular');
            }
        }

        // Check for plural forms
        foreach ($specials as $pattern) {
            if (preg_match($pattern[0], $string)) {
                return apply_filters(
                    'cuztom_pluralize',
                    ucwords(preg_replace($pattern[0], $pattern[1], $string)),
                    'special'
                );
            }
        }

        // Return if noting found
        return apply_filters('cuztom_pluralize', $string, null);
    }
public static function pluralize ( $ string ) { $ specials = apply_filters ( 'cuztom_plural' , [ [ '/(quiz)$/i' , '$1zes' ] , [ '/^(ox)$/i' , '$1en' ] , [ '/([m|l])ouse$/i' , '$1ice' ] , [ '/(matr|vert|ind)ix|ex$/i' , '$1ices' ] , [ '/(x|ch|ss|sh)$/i' , '$1es' ] , [ '/([^aeiouy]|qu)y$/i' , '$1ies' ] , [ '/([^aeiouy]|qu)ies$/i' , '$1y' ] , [ '/(hive)$/i' , '$1s' ] , [ '/(?:([^f])fe|([lr])f)$/i' , '$1$2ves' ] , [ '/sis$/i' , 'ses' ] , [ '/([ti])um$/i' , '$1a' ] , [ '/(buffal|tomat)o$/i' , '$1oes' ] , [ '/(bu)s$/i' , '$1ses' ] , [ '/(alias|status)$/i' , '$1es' ] , [ '/(octop|vir)us$/i' , '$1i' ] , [ '/(ax|test)is$/i' , '$1es' ] , [ '/s$/i' , 's' ] , [ '/$/' , 's' ] , ] ) ; $ irregular = apply_filters ( 'cuztom_irregular' , [ [ 'move' , 'moves' ] , [ 'sex' , 'sexes' ] , [ 'child' , 'children' ] , [ 'man' , 'men' ] , [ 'person' , 'people' ] , ] ) ; $ uncountable = apply_filters ( 'cuztom_uncountable' , [ 'sheep' , 'fish' , 'series' , 'species' , 'money' , 'rice' , 'information' , 'equipment' , 'pokemon' , ] ) ; // Save time if string in uncountable if ( in_array ( strtolower ( $ string ) , $ uncountable ) ) { return apply_filters ( 'cuztom_pluralize' , $ string , 'uncountable' ) ; } // Check for irregular words foreach ( $ irregular as $ noun ) { if ( strtolower ( $ string ) == $ noun [ 0 ] ) { return apply_filters ( 'cuztom_pluralize' , ucwords ( $ noun [ 1 ] ) , 'irregular' ) ; } } // Check for plural forms foreach ( $ specials as $ pattern ) { if ( preg_match ( $ pattern [ 0 ] , $ string ) ) { return apply_filters ( 'cuztom_pluralize' , ucwords ( preg_replace ( $ pattern [ 0 ] , $ pattern [ 1 ] , $ string ) ) , 'special' ) ; } } // Return if noting found return apply_filters ( 'cuztom_pluralize' , $ string , null ) ; }
Makes a word plural.

@param  string $string
@return string
Makes a word plural .