Novis\Intl\ListFormat::Type
The words ListFormat::join uses to join the items of a list.
ListFormat::Type is declared in the class Novis\Intl\ListFormat.
You pass a ListFormat::Type as type:
Andwrites "tea, coffee, and water" in English. This is the default.Orwrites "tea, coffee, or water", for a choice.Unitjoins the parts of one amount, such as "5 feet, 11 inches".
The words and the commas come from the locale. German writes "Tee, Kaffee und Wasser", with no comma before "und".
Examples
And or unit
<?nvs// Shows how each `ListFormat::Type` joins the same three items in English.use Novis\Intl\ListFormat;
array<array<string>> $lists = [['tea', 'coffee', 'water']];
echo ListFormat::join($lists, 'en', { type: ListFormat::Type::And })[0], "\n";echo ListFormat::join($lists, 'en', { type: ListFormat::Type::Or })[0], "\n";
// `Unit` joins amounts, such as the parts of a length.echo ListFormat::join([['5 feet', '11 inches']], 'en', { type: ListFormat::Type::Unit })[0], "\n";tea, coffee, and watertea, coffee, or water5 feet, 11 inches