How do I display the first letter as uppercase?

后端 未结 7 1348
孤城傲影
孤城傲影 2021-01-18 08:41

I have fname and lname in my database, and a name could be stored as JOHN DOE or john DOE or JoHN dOE, but ultimately I want to display it as John Doe

fname being Jo

7条回答
  •  醉话见心
    2021-01-18 09:22

    An example from php.net:

    $bar = 'HELLO WORLD!';
    $bar = ucfirst($bar);             // HELLO WORLD!
    $bar = ucfirst(strtolower($bar)); // Hello world!
    

    Bear in mind the notes about the locales though...

提交回复
热议问题