public static function pluralize($word)
        {
            if (isset(static::$_pluralized[$word])) {
                return static::$_pluralized[$word];
            }

            extract(static::$_plural);

            if (!isset($regexUninflected) || !isset($regexIrregular)) {
                $regexUninflected = static::_enclose(join('|', $uninflected + static::$_uninflected));
                $regexIrregular = static::_enclose(join('|', array_keys($irregular)));

                static::$_plural += compact('regexUninflected', 'regexIrregular');
            }

            if (preg_match('/(' . $regexUninflected . ')$/i', $word, $regs)) {
                return static::$_pluralized[$word] = $word;
            }

            if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
                $plural = substr($word, 0, 1) . substr($irregular[static::lower($regs[2])], 1);

                return static::$_pluralized[$word] = $regs[1] . $plural;
            }

            foreach ($rules as $rule => $replacement) {
                if (preg_match($rule, $word)) {
                    return static::$_pluralized[$word] = preg_replace($rule, $replacement, $word);
                }
            }

            return static::$_pluralized[$word] = $word;
        }
public static function pluralize($word)
        {
            if (isset(static::$_pluralized[$word])) {
                return static::$_pluralized[$word];
            }

            extract(static::$_plural);

            if (!isset($regexUninflected) || !isset($regexIrregular)) {
                $regexUninflected = static::_enclose(join('|', $uninflected + static::$_uninflected));
                $regexIrregular = static::_enclose(join('|', array_keys($irregular)));

                static::$_plural += compact('regexUninflected', 'regexIrregular');
            }

            if (preg_match('/(' . $regexUninflected . ')$/i', $word, $regs)) {
                return static::$_pluralized[$word] = $word;
            }

            if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
                $plural = substr($word, 0, 1) . substr($irregular[static::lower($regs[2])], 1);

                return static::$_pluralized[$word] = $regs[1] . $plural;
            }

            foreach ($rules as $rule => $replacement) {
                if (preg_match($rule, $word)) {
                    return static::$_pluralized[$word] = preg_replace($rule, $replacement, $word);
                }
            }

            return static::$_pluralized[$word] = $word;
        }
public static function pluralize ( $ word ) { if ( isset ( static :: $ _pluralized [ $ word ] ) ) { return static :: $ _pluralized [ $ word ] ; } extract ( static :: $ _plural ) ; if ( ! isset ( $ regexUninflected ) || ! isset ( $ regexIrregular ) ) { $ regexUninflected = static :: _enclose ( join ( '|' , $ uninflected + static :: $ _uninflected ) ) ; $ regexIrregular = static :: _enclose ( join ( '|' , array_keys ( $ irregular ) ) ) ; static :: $ _plural += compact ( 'regexUninflected' , 'regexIrregular' ) ; } if ( preg_match ( '/(' . $ regexUninflected . ')$/i' , $ word , $ regs ) ) { return static :: $ _pluralized [ $ word ] = $ word ; } if ( preg_match ( '/(.*)\\b(' . $ regexIrregular . ')$/i' , $ word , $ regs ) ) { $ plural = substr ( $ word , 0 , 1 ) . substr ( $ irregular [ static :: lower ( $ regs [ 2 ] ) ] , 1 ) ; return static :: $ _pluralized [ $ word ] = $ regs [ 1 ] . $ plural ; } foreach ( $ rules as $ rule => $ replacement ) { if ( preg_match ( $ rule , $ word ) ) { return static :: $ _pluralized [ $ word ] = preg_replace ( $ rule , $ replacement , $ word ) ; } } return static :: $ _pluralized [ $ word ] = $ word ; }
Changes the form of a word from singular to plural.

@param string $word Word in singular form.
@return string Word in plural form.
Changes the form of a word from singular to plural .