Contents

No headings were found on this page.

PHP Intl Functions

The intl extension in PHP provides capabilities for internationalization (i18n) and localization (l10n), supporting features like locale-aware formatting, transliteration, and message formatting. Below is a list of key functions provided by the intl extension.

Collator

  1. collator_asort(): Sort array maintaining index association.

collator_asort(Collator $coll, array &$arr, int $sort_flag = Collator::SORT_REGULAR): bool;

chgrp(): Changes the group ownership of a file.

chgrp($filename, $group);

collator_compare(): Compare two Unicode strings.

collator_compare(Collator $coll, string $str1, string $str2): int;

collator_get_attribute(): Get an attribute value.

collator_get_attribute(Collator $coll, int $attr): int|false;

collator_get_error_code(): Get collator’s last error code.

collator_get_error_code(Collator $coll): int;

collator_get_error_message(): Get text for collator’s last error code.

collator_get_error_message(Collator $coll): string;

collator_get_locale(): Get the locale name of the collator.

collator_get_locale(Collator $coll, int $type): string|false;

collator_get_sort_key(): Get sorting key for a string.

collator_get_sort_key(Collator $coll, string $string): string|false;

collator_get_strength(): Get the collator’s strength.

collator_get_strength(Collator $coll): int;

collator_set_attribute(): Set an attribute value.

collator_set_attribute(Collator $coll, int $attr, int $val): bool;

collator_set_strength(): Set the collator’s strength.

collator_set_strength(Collator $coll, int $strength): bool;

collator_sort(): Sort an array.

collator_sort(Collator $coll, array &$arr, int $sort_flag = Collator::SORT_REGULAR): bool;

collator_sort_with_sort_keys(): Sort array using specified sort keys.

collator_sort_with_sort_keys(Collator $coll, array &$arr): bool;

NumberFormatter

numfmt_create(): Create a number formatter.

numfmt_create(string $locale, int $style, ?string $pattern = null): ?NumberFormatter;

numfmt_format(): Format a number.

numfmt_format(NumberFormatter $fmt, int|float $num, int $type = NumberFormatter::TYPE_DEFAULT): string|false;

numfmt_format_currency(): Format a currency value.

numfmt_format_currency(NumberFormatter $fmt, float $value, string $currency): string|false;

numfmt_get_attribute(): Get an attribute value.

fgetcsv($handle, $length, $delimiter, $enclosure, $escape);

fgets(): Gets a line from a file pointer.

numfmt_get_attribute(NumberFormatter $fmt, int $attr): int|float|false;

numfmt_get_error_code(): Get formatter’s last error code.

numfmt_get_error_code(NumberFormatter $fmt): int;

numfmt_get_error_message(): Get text for formatter’s last error code.

numfmt_get_error_message(NumberFormatter $fmt): string;

numfmt_get_locale(): Get the locale name of the formatter.

numfmt_get_locale(NumberFormatter $fmt, int $type): string|false;

numfmt_get_pattern(): Get formatter pattern.

file_exists($filename);

numfmt_get_symbol(): Get a symbol value.

numfmt_get_symbol(NumberFormatter $fmt, int $attr): string|false;

numfmt_get_text_attribute(): Get a text attribute value.

numfmt_get_text_attribute(NumberFormatter $fmt, int $attr): string|false;

numfmt_parse(): Parse a number.

numfmt_parse(NumberFormatter $fmt, string $value, int $type = NumberFormatter::TYPE_DOUBLE, &$position = null): int|float|false;

numfmt_parse_currency(): Parse a currency number.

numfmt_parse_currency(NumberFormatter $fmt, string $value, string &$currency, &$position = null): float|false;

numfmt_set_attribute(): Set an attribute value.

numfmt_set_attribute(NumberFormatter $fmt, int $attr, int|float $value): bool;

numfmt_set_pattern(): Set formatter pattern.

numfmt_set_pattern(NumberFormatter $fmt, string $pattern): bool;

numfmt_set_symbol(): Set a symbol value.

numfmt_set_symbol(NumberFormatter $fmt, int $attr, string $value): bool;

MessageFormatter

msgfmt_create(): Create a message formatter.

msgfmt_create(string $locale, string $pattern): ?MessageFormatter;

msgfmt_format(): Format the message.

msgfmt_format(MessageFormatter $fmt, array $args): string|false;

msgfmt_format_message(): Quick format message.

msgfmt_format_message(string $locale, string $pattern, array $args): string|false;

msgfmt_get_error_code(): Get formatter’s last error code.

msgfmt_get_error_code(MessageFormatter $fmt): int;

msgfmt_get_error_message(): Get text for formatter’s last error code.

msgfmt_get_error_message(MessageFormatter $fmt): string;

msgfmt_get_locale(): Get the locale name of the formatter.

msgfmt_get_locale(MessageFormatter $fmt): string|false;

msgfmt_get_locale(MessageFormatter $fmt): string|false;

msgfmt_get_locale(MessageFormatter $fmt): string|false;

msgfmt_get_pattern(): Get formatter pattern.

msgfmt_get_pattern(MessageFormatter $fmt): string|false;

msgfmt_parse(): Parse input string.

msgfmt_parse(MessageFormatter $fmt, string $value): array|false;

msgfmt_parse_message(): Quick parse input string.

msgfmt_parse_message(string $locale, string $pattern, string $source): array|false;

msgfmt_set_pattern(): Set formatter pattern.

msgfmt_set_pattern(MessageFormatter $fmt, string $pattern): bool;

Normalizer

normalizer_is_normalized(): Checks if the provided string is already in the specified normalization form.

normalizer_is_normalized(string $input, int $form = Normalizer::FORM_C): bool;

normalizer_normalize(): Normalizes the input provided and returns the normalized string.

normalizer_normalize(string $input, int $form = Normalizer::FORM_C): string|false;

ResourceBundle

resourcebundle_create(): Create a resource bundle.

resourcebundle_create(string $locale, string $bundlename, bool $fallback): ?ResourceBundle;

resourcebundle_count(): Get the number of elements in the bundle.

resourcebundle_count(ResourceBundle $bundle): int;

resourcebundle_get(): Get data from the bundle.

resourcebundle_get(ResourceBundle $bundle, int|string $index): mixed;

resourcebundle_get_error_message(): Get text for bundle’s last error code.

resourcebundle_get_error_message(ResourceBundle $bundle): string;

resourcebundle_get_error_code(): Get bundle’s last error code.

resourcebundle_get_error_code(ResourceBundle $bundle): int;

resourcebundle_locales(): Get supported locales.

resourcebundle_locales(string $bundlename): array|false;

Related Chapters