How to convert the first letter of a String to lowercase in PHP


In PHP, lcfirst(string $string) is the inbuilt function to convert the first letter of a String to lowercase. And lcfirst(string $string) function is available from PHP 5.3.0+ version.

Similar Post: How to capitalize the first letter of a String in PHP

<?php

	$str1 = 'Ramayan';
	$str1 = lcfirst($str1);      
	echo $str1;                 // ramayan

	$str2 = 'GEETA';
	$str2 = lcfirst($str2);            
	echo $str2;                 // gEETA
	
	$str3 = '@Ramayan';
	$str3 = lcfirst($str3);             
	echo $str3;                 // @Ramayan
	
?>

References

  1. lcfirst
  2. How to capitalize the first letter of a String in PHP

Similar Posts

About the Author

Atul Rai
I love sharing my experiments and ideas with everyone by writing articles on the latest technological trends. Read all published posts by Atul Rai.