IntlListFormatter::format
PHP function
Edit on GitHub ✎
Format a list of items
Description
IntlListFormatter::format(array $list): string|false
Formats a list of items as a locale-appropriate string.
Parameters
listAn array of strings to format as a list.
Return Values
The formatted list as a string, or false on failure.
Examples
IntlListFormatter::format example
php
<?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
?>See Also
IntlListFormatter::__construct