假设我有一个数组Tomat, Ost
我怎样才能这样做:Tomat, ost
?
$ingredient_a = Array('Tomat', 'Ost');
echo implode(', ', $ingredient_a);
答案 0 :(得分:5)
将ucfirst
和array_map
与strtolower
echo ucfirst(implode(', ', array_map('strtolower',$ingredient_a)));
答案 1 :(得分:0)
$ingredient_a = array('Tomat', 'Ost');
$new = array();
foreach($ingredient_a as $key => $value) {
$key == 0 ? $new[] = $value : $new[] = strtolower($value);
}
echo implode(', ', $new);