做网站的实验报告,湖州做网站的,学历提升咨询,建公司网站要提供哪些素材6、chunk_split() 函数把字符串分割为一连串更小的部分。本函数不改变原始字符串。 语法#xff1a;chunk_split(string,length,end) 参数#xff1a; string——必需。规定要分割的字符串。 length——可选。一个数字#xff0c;定义字符串块的长度。 end——可选。字符串值…6、chunk_split() 函数把字符串分割为一连串更小的部分。本函数不改变原始字符串。 语法chunk_split(string,length,end) 参数 string——必需。规定要分割的字符串。 length——可选。一个数字定义字符串块的长度。 end——可选。字符串值定义在每个字符串块之后放置的内容。 例子 1 本例分隔每个字符并添加 . ?php
$str Hello world!;
echo chunk_split($str,1,.);
? 输出 H.e.l.l.o. .w.o.r.l.d.!. 例子 2 本例将在六个字符之后分割一次字符串并添加 ... ?php
$str Hello world!;
echo chunk_split($str,6,...);
? 输出 Hello ...world!... 7、convert_cyr_string() 函数把字符由一种 Cyrillic 字符转换成另一种。 被支持的 Cyrillic 字符集是 k - koi8-rw - windows-1251i - iso8859-5a - x-cp866d - x-cp866m - x-mac-cyrillic语法 convert_cyr_string(string,from,to) 8、convert_uudecode() 函数对 uuencode 编码的字符串进行解码。 语法convert_uudecode(string) 例子 在本例中我们将通过使用 convert_uudecode() 对 uuencode 编码的字符串进行解码 ?php
$str ,25L;\V]R;0A ;
echo convert_uudecode($str);
? 输出 Hello world! 9、convert_uuencode() 函数使用 uuencode 算法对字符串进行编码。 语法convert_uuencode(string) 注意 本函数把所有字符串包括二进制的转换为可打印的字符串确保其网络传输的安全。uuencode 的字符串比原字符串增大大约 35%。 例子 在本例中我们将使用 convert_uuencode() 对字符串进行编码 ?php
$str Hello world!;
echo convert_uuencode($str);
? 输出 ,25L;\V]R;0A 10、count_chars() 函数返回字符串所用字符的信息。 语法 count_chars(string,mode) 参数 描述 string 必需。规定要检查的字符串。 mode 可选。规定返回模式。默认是 0。有以下不同的返回模式 0 - 数组ASCII 值为键名出现的次数为键值 1 - 数组ASCII 值为键名出现的次数为键值只列出出现次数大于 0 的值 2 - 数组ASCII 值为键名出现的次数为键值只列出出现次数等于 0 的值 3 - 字符串带有所有使用过的不同的字符 4 - 字符串带有所有未使用过的不同的字符 实例 例子 1 在本例中我们将使用 count_chars() 来检查字符串返回模式设置为 1 ?php
$str Hello World!;
print_r(count_chars($str,1));
? 输出 Array
(
[32] 1
[33] 1
[72] 1
[87] 1
[100] 1
[101] 1
[108] 3
[111] 2
[114] 1
) 例子 2 在本例中我们将使用 count_chars() 来检查字符串返回模式设置为 3 ?php
$str Hello World!;
echo count_chars($str,3);
? 输出 !HWdelor转载于:https://www.cnblogs.com/quincy-qiu/p/4015334.html