<?php
function getNeedBetween($kw1,$mark1,$mark2){
$kw=$kw1;
$kw='123′.$kw.'123′;
$st =stripos($kw,$mark1);
$ed =stripos($kw,$mark2);
if(($st==false||$ed==false)||$st>=$ed)
return 0;
$kw=substr($kw,($st+1),($ed-$st-1));
return $kw;
}
?>
$keyword='查找(计组实验)'
$need=getNeedBetween($keyword, '(' , ')' );
结果:
$need='计组实验';标签:false,ed,截取,st,kw,need,PHP,个字符,stripos From: https://blog.51cto.com/u_15967457/6065086