简体   繁体   中英

How do I make first letter big in php

when I echo a name in $_session['name']; it says "h" rnoob but the first letter is little, and I want makes it so the first letter is big like "H" rnoob??

尝试

ucfirst($_session['name']);

Use php function ucfirst() which will give the first character of string in uppercase.

   $test = ucfirst($_session['name']);
   echo $test;

i hope this will help you

You can use ucfirst function of php as:

ucfirst($_session['name'])

and you can check different functions for respective from PHP Manual

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM