How do I echo text in capital letters?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 04:33:53

问题


I want to know how to capitalize in PHP


回答1:


echo strtoupper('hello');

strtoupper will capitalize the whole string.

If you're only interested in capitalizing the first letter, you can use ucfirst:

echo ucfirst('hello!'); //Hello!

If you want to capitalize the first letter of each word in a string, use ucwords:

echo ucwords('hello world!'); //Hello World!



回答2:


The strtoupper() function is what you're looking for.



来源:https://stackoverflow.com/questions/1054631/how-do-i-echo-text-in-capital-letters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!