PHP 8.6.0 Alpha 2 available for testing

IntlListFormatter::format

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

IntlListFormatter::formatFormat a list of items

说明

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

Formats a list of items as a locale-appropriate string.

参数

list
An array of strings to format as a list.

返回值

The formatted list as a string, or false on failure.

示例

示例 #1 IntlListFormatter::format() example

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