重写PHP的explode办法

function rexplode($delimiter, $str){
	$d_len = strlen($delimiter);
	$arr = array();
	$i = $pos = 0;
	while (false !== ($pos = stripos($str.$delimiter, $delimiter, $pos)) ) {
		$arr[] = mb_substr($str, $i, $pos-$i);
		$i = $pos + $d_len;
		$pos += $d_len;
	}
	return array_filter($arr);
}

版权声明:本文博主原创文章,博客,未经同意不得转载。

原文地址:https://www.cnblogs.com/zfyouxi/p/4908207.html