'/'
-'/'
?php
$s='-i-';
$
=
;
("str_preg('$s');",$times);printcycle("str_preg2('$s');",$times);printcycle("str_sub_replace('$s');",$times);printcycle("str_trim('$s');",$times);printcycle("str_clear('$s');",$times);
//print_r(str_preg2($s));
function
cycle
(
$function
,
$times
){
$count=0;if($times1){returnfalse;}
$start=microtime(true);while($times$count){eval($function);$count++;}
$end=microtime(true)-$start;return"
$functionexectime:$end";}
functionstr_clear($s){$s=explode('/',$s);$s=array_filter($s,function($s){if(!empty($s))returntrue;});return$s;}
functionstr_preg2($s){$s=preg_replace('/((?!.)\/(?=.))?((?=.)\/(?!.))?/i','',$s);$s=explode('/',$s);return$s;}
functionstr_preg($s){$s=preg_replace('/^(\/?)(.*?)(\/?)$/i','$2',$s);$s=explode('/',$s);return$s;}
functionstr_sub_replace($s){$s=str_replace('/','',mb_substr($s,0,1)).mb_substr($s,1,-1).str_replace('/','',mb_substr($s,-1));$s=explode('/',$s);return$s;}
functionstr_trim($s){$s=trim($s,'/');$s=explode('/',$s);return$s;}