6.
@cnhong,$arr[]=$s2改成$arr.=$s2←_←注意有个点
7.
@cnhong,错了,$arr[]=$e['0'];改成$arr.=$e['0'];//注意有个点
8. 经测试,这样才对
<?php
//Big Brother
//2014-06-07
//支持正则表达式
function cut( $str , $start ,$end, $pre = false,$xz1 = 'Uis',$xz2 = 'Uis' ){
if( $pre ){
$ex = preg_split ( "!{$start}!{$xz1} " , $str );
} else{
$ex = explode ($start , $str ) ; //不用正则,砍他一刀
}
unset ( $ex['0']) ; //这个数组木有用,让它去屎吧
//$arr = array() ; //超人附身
foreach ( $ex as $s ){
if( $pre ){
$e = preg_split ( "!{$end}!{$xz2}" , $s ) ;
} else{
$e = explode( $end , $s ) ; //不用正则,再他一刀
}
$arr= $e['0'] ; //它生下了仔仔
}
return $arr ;//超人带着仔仔出来拯救世界
}
$str="老婆奴极乐世界女Paul就你俩鸡婆owl了是无聊路上";
$start="奴";
$end="就";
//print_r(cut($str,$start,$end));
$arr=cut($str,$start,$end);
echo $arr;
?>
@拒绝柳岩99次,
9. 43行超人付身干什么呢?来,我们看看20行,原来是让他生仔哦!
10. 经测试,这样才对
<?php
//Big Brother
//2014-06-07
//支持正则表达式
function cut( $str , $start ,$end, $pre = false,$xz1 = 'Uis',$xz2 = 'Uis' ){
if( $pre ){
$ex = preg_split ( "!{$start}!{$xz1} " , $str );
} else{
$ex = explode ($start , $str ) ; //不用正则,砍他一刀
}
unset ( $ex['0']) ; //这个数组木有用,让它去屎吧
//$arr = array() ; //超人附身
foreach ( $ex as $s ){
if( $pre ){
$e = preg_split ( "!{$end}!{$xz2}" , $s ) ;
} else{
$e = explode( $end , $s ) ; //不用正则,再他一刀
}
$arr= $e['0'] ; //它生下了仔仔
}
return $arr ;//超人带着仔仔出来拯救世界
}
$str="如何不让他输出数组呢? ";
$start="何";
$end="呢";
print_r(cut($str,$start,$end));
$arr=cut($str,$start,$end);
echo $arr;
$arr=cut($str,$start,$end,true);
echo $arr;
?>
@拒绝柳岩99次,