Blogger Information
Blog 29
fans 0
comment 0
visits 19512
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
字符串函数
千里马遇伯乐
Original
684 people have browsed it

字符串函数

  1. <?php
  2. // mb_substr返回中文字符串的一部分
  3. echo mb_substr("你好朋友", 0, 2);
  4. // 输出:你好
  5. ?><hr>
  6. <!-- 把字符串中的首字符转换为大写。 -->
  7. <?php
  8. echo ucfirst("hello world!");
  9. ?> <hr>
  10. <!-- 把字符串中每个单词的首字符转换为大写 -->
  11. <?php
  12. echo ucwords("hello world");
  13. ?> <hr>
  14. <!-- 把字符串单词替换成文字 -->
  15. <?php
  16. $arr = array("Hello" => "你好", "world" => "朋友");
  17. echo strtr("Hello world",$arr);
  18. ?><hr>
  19. <!-- 反转字符串 -->
  20. <?php
  21. echo strrev("1234567");
  22. ?>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post