Sunday 27 July 2014

Filled Under:

lcfirst(), ucfirst() and ucwords() in php

lcfirst() Function:

                                    lcfirst() function that is use to convert the first character of string in lowercase letter. It is also very useful function in php many example of this function in php one of them comparison the value from data base.

Syntax:

          lcfirst(string);

Example:

<?php
$str=”HELLO PHP”;
echo lcfirst($str);
?>

Output:

         hELLO PHP

ucfirst() Function:

                                    ucfirst() function that is use to convert the first character of string in uppercase letter. It is also very useful function in php many example of this function in php one of them comparison the value from data base.

Syntax:

          ucfirst(string);

Example:

<?php
$str=”hello PHP”;
echo ucfirst($str);
?>

Output:

         Hello PHP

ucwords() Function:

                                    ucwords() function that is use to convert the first character of each word in string to uppercase letter. It is also very useful function in php many example of this function in php one of them comparison the value from data base.

Syntax:

          ucwords(string);

Example:

<?php
$str=”hello php”;
echo ucwords($str);
?>

Output:


         Hello Php




0 comments:

Post a Comment