Erik Edgren Erik Edgren - 3 months ago 9
PHP Question

Make all the strings of a string array into lower case except for the first word

Supposing I have an array

Tomat, Ost

How can I accomplish so it is like this:
Tomat, ost
?

$ingredient_a = Array('Tomat', 'Ost');
echo implode(', ', $ingredient_a);

Answer

Use ucfirst and array_map with strtolower

echo ucfirst(implode(', ', array_map('strtolower',$ingredient_a)));