ucfirst() function in PHP


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

Syntax

ucfirst(str)

Parameters

  • str − The specified string

Return

The ucfirst() function returns the converted string.

Example

The following is an example −

Live Demo

<?php
   echo ucfirst("demo");
?>

Output

Demo

Updated on: 30-Jul-2019

62 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements