ucfirst()
functionYou can use the PHP ucfirst()
function to change the first character of a string to uppercase (i.e. capital). Alternatively, you can use the strtolower()
function in combination with the ucfirst()
function, if you want to make only first letter of the string to uppercase and rest of the string to lowercase. Let's check out an example to understand how it works:
<?php
$str1 = 'the color of the sky is blue.';
echo ucfirst($str1);
echo "<br>";
$str2 = 'the Color of the Sky is Blue.';
echo ucfirst(strtolower($str2));
?>
i hope you like this article.
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on harsukh21@gmail.com
How to find the number of characters in a string using jQuery
Use the jQuery .length property The j...How to Check Whether a String Contains a Substring in JavaScript
Use the indexOf() Method Th...How to Convert Comma Separated String into an Array in JavaScript
Use the split() Method You can use th...How to Insert an Item into an Array at a Specific Index in JavaScript
Use the JavaScript splice() Method Yo...How to Check If the Mouse is Over an Element in jQuery
Use the CSS :hover Pseudo-class You c...