PHP ucfirst

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : ucfirst() function

Description

The ucfirst() function is used to convert the first character of a string to uppercase.

Version

(PHP 4 and above)

Syntax

ucfirst(string_name)

Parameter

Name

Description

Required /
Optional

Type

string_name

The input string.

Required

String

 

Return value

Returns the modified string.

Value Type : String.

Pictorial Presentation

string_ucfirst

Example :

  1. $string_name='welcome to w3resource.com';  

  2. $string_name=ucfirst($string_name);  

  3. echo $string_name;  

  4. ?>  

Output :

Welcome to www.tutorialtours.com