Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(PHP) making string lowercase , with exception of first letter [duplicate]

I've made a simple textbox which leads to a new page which echo's the input word by word (explode). Now i want to to change all the letters to lowercase except the first letter (if this is inputted this way)

for example : Herman Archer LIVEs in NeW YORK --> Herman Archer lives in new york

I hope you can help me out , thanks in advance!

like image 552
Syff Avatar asked Mar 04 '14 11:03

Syff


1 Answers

$str = 'stRing';
ucfirst(strtolower($str));

Will output: String

like image 152
James Elliott Avatar answered Sep 28 '22 11:09

James Elliott