如何在大写字母中回显文本? [英] How do I echo text in capital letters?

查看:132
本文介绍了如何在大写字母中回显文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在PHP中大写

I want to know how to capitalize in PHP

推荐答案

echo strtoupper('hello');

strtoupper 将大写整个字符串。

如果您只对首字母大写感兴趣,则可以使用 ucfirst

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

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

如果要大写字符串中每个单词的首字母,请使用 ucwords

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

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

这篇关于如何在大写字母中回显文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆