I have an array ($number_list
) that has a dynamically generated list of values. There will be at least 1 value in the array and no more than 4.
Currently, I have a nice way of having a comma separated list using this...
$comma_list = implode(', ', $number_list);
However, I'd like to keep with English convention and have the word "and" before the last element. So, let's say $number_list contains the values 4, 5, 6, 7. I would want to echo a statement like, "The list is 4, 5, 6, and 7."
Any ideas how to get that and in there?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…