PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

博客列表 > 字符串函数学习

字符串函数学习

阿杰
阿杰 原创
2022年05月04日 13:28:43 516浏览

字符串函数

1、md5() 加密

  1. // md5加密
  2. $password = '123456';
  3. echo md5($password);

2、strtoupper() 字符串转大写

  1. // strtoupper 字符串转大写
  2. $str1 = 'abcdefghijklmn';
  3. echo strtoupper($str1).'<hr>';

3、strtolower() 字符串转小写

  1. // strtolower 字符串转小写
  2. $str2 = 'JKDHJKSDHFJKSJDFH';
  3. echo strtolower($str2).'<hr>';

4、 str_ireplace() 替换指定字符串(不区分大小写)

  1. // str_ireplace 替换指定字符串(不区分大小写)
  2. $str3 = '你好呀A省,a市,a区';
  3. echo str_ireplace("A","B",$str3).'<hr>';

5、str_word_count() 计算字符串的单词数量

  1. // str_word_count 计算字符串的单词数量
  2. $str4 = '你好hello加点water';
  3. echo str_word_count($str4).'<hr>';

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议