Blogger Information
Blog 38
fans 0
comment 0
visits 18870
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
实例演示5个字符串函数
Blackeye
Original
416 people have browsed it

1

  1. <?php
  2. // 1.
  3. // addslashes (PHP 4, PHP 5, PHP 7, PHP 8)
  4. // addslashes — 使用反斜线引用字符串
  5. // addslashes(string $str): string
  6. $str = "I'm your 1'st friend";
  7. echo addslashes($str);
  8. echo "<br/>";
  9. // 2.
  10. // crypt (PHP 4, PHP 5, PHP 7, PHP 8)
  11. // crypt — 单向字符串散列
  12. // crypt(string $str, string $salt = ?): string
  13. echo crypt("password","HiDave");
  14. echo "<br/>";
  15. // 3.
  16. // md5 (PHP 4, PHP 5, PHP 7, PHP 8)
  17. // md5 — 计算字符串的 MD5 散列值
  18. // md5(string $string, bool $binary = false): string
  19. echo md5("Dave");
  20. echo "<br/>";
  21. echo md5("Dave", true);
  22. echo "<br/>";
  23. // 4.
  24. // str_shuffle (PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
  25. // str_shuffle — 随机打乱一个字符串
  26. // str_shuffle(string $str): string
  27. echo str_shuffle("Hello Dave") . "<br/>";
  28. // 5.
  29. // ord (PHP 4, PHP 5, PHP 7, PHP 8)
  30. // ord — 转换字符串第一个字节为 0-255 之间的值
  31. // ord(string $string): int
  32. echo ord("H") . "<br/>";
  33. echo ord("HW") . "<br/>";
  34. // 6.
  35. // strrev (PHP 4, PHP 5, PHP 7, PHP 8)
  36. // strrev — 反转字符串
  37. // strrev(string $string): string
  38. echo strrev("!nc.php iH") . "<br/>";
  39. // 7.
  40. // ucfirst (PHP 4, PHP 5, PHP 7, PHP 8)
  41. // ucfirst — 将字符串的首字母转换为大写
  42. // ucfirst(string $str): string
  43. echo ucfirst("hello dave!") . "<br/>";
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!