Home  >  Article  >  Backend Development  >  How to remove specified string in php

How to remove specified string in php

藏色散人
藏色散人Original
2020-10-09 09:16:122741browse

php method to remove the specified string: first create a PHP sample file; then remove the specified string through the "substr_replace($a,"",$count,2);" method; finally output the result through echo That’s it.

How to remove specified string in php

Recommended: "PHP Video Tutorial"

PHP code to find the specified string in the string and delete it

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

Output result: cababa

The above is the detailed content of How to remove specified string in php. For more information, please follow other related articles on the PHP Chinese website!

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