Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the first Char Upper in PHP?

Tags:

string

php

I need to know how i can make a string like "hello" to "Hello" using PHP? I just need the first character to be Upper

like image 753
streetparade Avatar asked Dec 01 '22 05:12

streetparade


1 Answers

use the function ucwords(); This will do every word in the string, using ucfirst() will just do the first word.

echo ucwords('hello my name is jim');

// Hello My Name Is Jim

echo ucfirst('hello my name is jim');

// Hello my name is jim
like image 94
Lizard Avatar answered Dec 04 '22 13:12

Lizard