在php中会为我们提供一些常用的字符操作函数,下面我来整理了php中字符大小写转换的函数,这里我会一个个介绍,希望例子能给各位同学带来帮助.
每个单词的首字母转换为大写:ucwords()
第一个单词首字母变大写:ucfirst()
第一个单词首字母变小写:lcfirst()
所有 字母变大写:strtoupper()
PHP实例代码如下:
- <?php
- echo strtoupper("Hello WORLD!");
- ?>
- //输出:HELLO WORLD!
第一个单词首字母变大写:ucfirst(),代码如下:
- <?php
- $foo = 'where are doing?!';
- $foo = ucfirst($foo); // where are doing?!
- $bar = 'where are doing?!';
- $bar = ucfirst($bar); // where are doing?!
- $bar = ucfirst(strtolower($bar)); // where are doing?!
- ?>
所有 字母变小写:strtolower(),代码如下:
- <?php
- $str = "Mary Had A Little Lamb and She LOVED It So";
- $str = strtolower($str);
- echo $str; // Prints mary had a little lamb and she loved it so
- ?>
每个单词的首字母转换为大写:ucwords(),代码如下:
- <?php
- $foo = 'where are doing?!';
- $foo = ucwords($foo); // Where are doing?!
- $bar = 'where are doing?!';
- $bar = ucwords($bar); // Where are doing?!
- $bar = ucwords(strtolower($bar)); // Where are doing?!
- ?>
第一个单词首字母变小写:lcfirst(),代码如下:
- <?php
- $foo = 'HelloWorld';
- $foo = lcfirst($foo); // where are doing
- $bar = 'where are doing?!';
- $bar = lcfirst($bar); // where are doing?!
- $bar = lcfirst(strtoupper($bar)); // where are doing?!
- ?>
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » php中英文字符转换大小写代码
波比源码 » php中英文字符转换大小写代码
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across. Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…
Thank you for content. Area rugs and online home decor store. Hello Administ . Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…
Everything is very open and very clear explanation of issues. was truly information. Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…
Good info. Lucky me I reach on your website by accident, I bookmarked it. Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…
Thank you for great information. Hello Administ . Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Onwin , Onwin Giriş , Onwin Güncel Giriş , Onwin Yeni Adres , onwin
Hackdra’s smart contract auditing service ensures that decentralized applications and smart contracts are free of vulnerabilities and security loopholes. Request free smart contract audit now.
Hackdra has completed the audit of the famous giant exchange. Successfully completed bsc audit ensured decentralized applications and smart contracts were free of vulnerabilities and security loopholes.