Home  >  Article  >  Backend Development  >  PHP code to find a specified string in a string and delete it_PHP tutorial

PHP code to find a specified string in a string and delete it_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:49:36795browse

$a = "abcababa";
$count=strpos($a,"ab");
$str=substr_replace($a,"",$count,2);

Output Result: cababa
Although the code is short, it is still a small algorithm!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319506.htmlTechArticle$a = "abcababa"; $count=strpos($a,"ab"); $str=substr_replace ($a,"",$count,2); Output result: cababa Although the code is short, it is still a small algorithm! ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn