开发者

How to make first letter of a word capital?

开发者 https://www.devze.com 2023-02-22 09:31 出处:网络
I have a word default and 开发者_运维知识库I want a php function to make only first letter capital. Can we do that. Please help me out as I am very new to php coding.You may want to use ucfirst().

I have a word default and 开发者_运维知识库I want a php function to make only first letter capital. Can we do that. Please help me out as I am very new to php coding.


You may want to use ucfirst().

For multibyte strings, please see this snippet.


ucfirst capitalizes the first letter in a string.

ucwords capitalizes every word in a string.


Hello Geeta you can simply use ucwords() php function to make every first letter of your word Upper Cased!

Hope this would help!


I think that http://se2.php.net/manual/en/function.ucwords.php is the best function here :)


This is the code you need:

<?php

$string = 'stackoverflow';
$string = ucfirst($string);
echo $string;

?>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号