Home > Backend Development > PHP Tutorial > 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
Release: 2016-07-21 15:49:36
Original
803 people have browsed it

$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! ...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template