function get_string_between($string, $start, $end, $preo) {
if (strpos($string,$start)===FALSE) {
return $preo;
} else {
if (strlen($string)!==0) {
$ini = strpos($string, $start);
$pre = substr($string,0,$ini);
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
$part = chr(substr($string, $ini, $len));
$preo .= $pre;
$preo .= $part;
$newString = substr($string, strlen($pre) + strlen(substr($string,$len)) + strlen($start) + strlen($end), strlen($string)-strlen($pre));
get_string_between($newString,$start,$end,$preo);
}
}
}
$rr = get_string_between("vishalOo59oOOo59oO", 'Oo', 'oO', '');
var_dump($rr);
上面的程序正在返回null。
慕少森
慕工程0101907