Erik Edgren Erik Edgren - 1 year ago 87
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 Source

Use ucfirst and array_map with strtolower

echo ucfirst(implode(', ', array_map('strtolower',$ingredient_a)));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download