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
?>

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.