现在的位置: 首页 > 综合 > 正文

php中几个字符函数小结

2012年11月16日 ⁄ 综合 ⁄ 共 874字 ⁄ 字号 评论关闭

简介:这是php中几个字符函数小结的详细页面,介绍了和php,string, php php中几个字符函数小结有关的知识、技巧、经验,和一些php源码等。

class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=351043' scrolling='no'>
  下面小结PHP中的几个字符函数,小结一下:

1)ucfirst

   将首字母变大写,比如

  $string = "this is my web development blog";

echo ucfirst($string);

// Output: This is my web development blog

2) lcfirst,将首字母变小写

   $string = "This is my Web Development Blog";

echo lcfirst($string);

// Output: this is my Web Development Blog

3)strtoupper,将整个字符串变大写

   $string = "this is my web development blog";

echo strtoupper($string);

// Output: THIS IS MY WEB DEVELOPMENT BLOG

4) strtoplower,将整个字符串变小写

   $string = "tHiS is mY WeB DevElOpMenT bLoG";

echo strtolower($string);

// Output: this is my web development blog

5)ucwords(),可以将句子中每个单词的第一个字母变大写,比如

   $string = "this is my web development blog";

echo ucwords($string);

// Output: This Is My Web Development Blog

爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

http://biancheng.dnbcw.info/php/351043.html pageNo:3

抱歉!评论已关闭.