博主信息
博文 38
粉丝 0
评论 0
访问量 25765
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
实例演示5个字符串函数
Blackeye
原创
617人浏览过

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/>";
批改老师:PHPzPHPz

批改状态:合格

老师批语:
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学