来看看输入了局: 本人的函数挪用运转工夫为:9.3936920166E-005 S
尺度的函数挪用运转工夫为:2.69412994385E-005 S
前者是后者的:3 倍!
屡次刷新页面的话,可以发明尺度函数的履行效力根基上是本人的函数的 3 倍!固然,尺度的函数中利用了 PHP 的内置函数: str_split(),implode(),所以要比本人写函数快很多,对 str_split() 函数没有印象?来看看手册注释:
str_split -- Convert a string to an array(将一个字符串转换成数组) 函数描写: array str_split ( string string [, int split_length] ) 复制代码 代码以下:
Converts a string to an array. If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length.
FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string, the entire string is returned as the first (and only) array element.