php 删除了字符串中任何字符的办法
function delStr($start, $end, $orgenStr) { //读取要删除了字符地位的前一局部字符串,并赋值给$temp //strpos读取字符第一次呈现的地位 //substr读取指定开端与完结地位的子字符串 //echo $before."—". $last; $temp=$orgenStr; while(strpos($temp, $start) && strpos($temp, $end)){ $temp=substr($temp, 0, strpos($temp, $start)).substr($temp,strpos($temp, $end)+strlen($end));; //读取要删除了字符地位的后一局部字符串,而后将先后局部衔接,并赋值给$temp //前往最初是字符串 } return $temp; } //使用实例 $a="aaaa12345678bbbbtttttttttttttttttttttaaaa12345678bbbb kkkkkkkkkkkkaaaa12345678bbbbttttttttttttttttttttt"; $b="1234"; $c="5678"; echo delStr($b,$c,$a);
输入后果:
保举:《PHP教程》
以上就是php 删除了字符串中任何字符的办法的具体内容,更多请存眷资源魔其它相干文章!
版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。
抱歉,评论功能暂时关闭!