Blogger Information
Blog 30
fans 0
comment 0
visits 13894
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
实例演示字符串函数
天宁
Original
445 people have browsed it
md5(),把字符串进行md5加密
  1. //md5()两个参数
  2. //1.要计算的字符串
  3. //2.可选,true,md5返回16字符长度的2进制,默认false,返回32字符的16进制数
  4. echo md5('你好545'), '<br>';
  5. echo md5('你好545', true);
quotemeta(),转义元字符集,给字符串特特殊字符添加转义符
  1. $str = "Hello world. (can you hear me?)";
  2. echo quotemeta($str);
  3. //返回 Hello world\. \(can you hear me\?\)
str_shuffle(),随机打乱字符串
  1. $shuffled = str_shuffle('abcdef');
  2. echo $shuffled;
strrev(),反转字符串
  1. echo strrev("Hello world!");
substr_count(),计算字符串出现次数
  1. $text = 'This is a test';
  2. echo substr_count($text, 's'); // 3
  3. echo substr_count($text, 's', 5); // 2,从第6个开始计算,只有两个s
ucfirst(),将字符串首字母转换成大写
  1. $foo = ucfirst('hello world!');
  2. echo $foo;
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