php tutorial - PHP ucfirst and lcfirst - php programming - learn php - php code - php script



  • The ucfirst string function is used for defining the first character of a string value in upper case.
  • The lcfirst string function is used for defining the first character of a string value in lower case.

Sample Code in php : sample php program

<!DOCTYPE html>
<html>
    <body>
        <?php
            echo ucfirst("wikitechy");
	    echo "<br>";
	    echo lcfirst("WIKITECHY");
        ?>
    </body>
</html>
click below button to copy the code. php tutorial - team

php programmer Code Explanation :

Code Explanation for ucfirst lcfirst In PHP

  1. echo statement we call the “ucfirst” string function which is used for converting the first letter of the “wikitechy” in uppercase.
  2. echo statement we call the “lcfirst” string function which is used for converting the first letter of the “WIKITECHY” in lowercase.

php development Sample Output :

output for ucfirst lcfirst In PHP

  1. output -> first letter of the term “wikitechy” has been changed to upper case.
  2. Similarly, over here the first letter of the term “WIKITECHY” has been changed to lower case.


Related Searches to php ucfirst lcfirst