PHP function to delete all between certain character(s) in string

前端 未结 5 1043
感情败类
感情败类 2020-11-27 17:21

I\'m interested in function delete_all_between($char1, $char2, $string) that will search given $string for $char1 and $char2 and, if such has been found, clear

5条回答
  •  我在风中等你
    2020-11-27 17:45

    I think substr() works too slow. The best way is:

    return substr($string, 0, $beginningPos) . 
           substr($string, $endPos + strlen($end));
    

提交回复
热议问题