Home  >  Article  >  php教程  >  PHP 大小写转化函数的笔记

PHP 大小写转化函数的笔记

WBOY
WBOYOriginal
2016-06-06 19:44:14957browse

几个月没用PHP写程序,发现自己连PHP 大小写转化函数都忘记了,这里写篇记录



几个月没用PHP写程序,发现自己连PHP 大小写转化函数都忘记了,这里写篇记录啊。希望需要的童鞋能看。


1.将字符串转换成小写


   strtolower(): 该函数将传入的字符串参数所有的字符都转换成小写,并以小定形式放回这个字

符串.
例:
       $str = "I want To FLY";
     $str = strtolower($str);
     echo $str;
 ?>

输出结果:

i want to fly


 2.将字符转成大写
   strtoupper(): 该函数的作用同strtolower函数相反,是将传入的字符参数的字符全部转换成大

写,并以大写的形式返回这个字符串.用法同strtolowe()一样.

3.将字符串首字符转换成大写

淮安掼蛋网(www.gamefrye.com)
    usfilst(): 该函数的作用是将字符串的第一个字符改成大写,该函数返回首字符大写的字符串.

用法同strtolowe()一样.

4.将字符串每个单词的首字符转换成大写
   ucwords(): 该函数将传入的字符串的每个单词的首字符变成大写.如"hello world",经过该函数

处理后,将返回"Hello Word".用法同strtolowe()一样.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn