Title: Gettext_Translations::nplurals_and_expression_from_header
Published: April 25, 2014
Last modified: August 20, 2026

---

# Gettext_Translations::nplurals_and_expression_from_header( string $header ): array{0:

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#wp--skip-link--target)

Returns the nplurals and plural forms expression from the Plural-Forms header.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#parameters)󠁿

 `$header`stringrequired

## 󠀁[Return](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#return)󠁿

 array{0: int, 1: string}

## 󠀁[Source](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#source)󠁿

    ```php
    public function nplurals_and_expression_from_header( $header ) {
    	if ( preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches ) ) {
    		$nplurals   = (int) $matches[1];
    		$expression = trim( $matches[2] );
    		return array( $nplurals, $expression );
    	} else {
    		return array( 2, 'n != 1' );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/pomo/translations.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/pomo/translations.php#L302)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/pomo/translations.php#L302-L310)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#related)󠁿

| Used by | Description | 
| [Gettext_Translations::gettext_select_plural_form()](https://developer.wordpress.org/reference/classes/gettext_translations/gettext_select_plural_form/)`wp-includes/pomo/translations.php` |

The gettext implementation of select_plural_form.

  | 
| [Gettext_Translations::set_header()](https://developer.wordpress.org/reference/classes/gettext_translations/set_header/)`wp-includes/pomo/translations.php` |

Sets translation headers.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/gettext_translations/nplurals_and_expression_from_header/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fgettext_translations%2Fnplurals_and_expression_from_header%2F)
before being able to contribute a note or feedback.