IntlListFormatter::format
PHP Manual
PHP Manual»IntlListFormatter»IntlListFormatter::format

IntlListFormatter::format

(No version information available, might only be in Git)

IntlListFormatter::format — Форматирует список элементов

Описание

public function IntlListFormatter::format(array $list): string|false

Метод форматирует список элементов в виде строки с учётом локали.

Список параметров

list

Массив для преобразования в форматированный список.

Возвращаемые значения

Метод возвращает отформатированный список в виде строки или false, если возникла ошибка.

Примеры

Пример #1 Пример форматирования списка методом IntlListFormatter::format()

<?php

$fmt = new IntlListFormatter('en_US', IntlListFormatter::TYPE_AND, IntlListFormatter::WIDTH_WIDE);
echo $fmt->format(['one', 'two', 'three']);
// one, two, and three

$fmt = new IntlListFormatter('en_US', IntlListFormatter::TYPE_OR, IntlListFormatter::WIDTH_WIDE);
echo $fmt->format(['one', 'two', 'three']);
// one, two, or three

Смотрите также

To Top