PHP in the string to find the specified string and delete the code, the web search is said, but the actual effect is not so good, or that the effect is not well
$a = "abcababa"; $count=strpos($a,"ab"); $str=substr_replace($a,"",$count,2);var_dump($str);?>
The effect is as follows
OK, this may be the effect you want, but PHP's own function will solve the problem perfectly.
The code is as follows
var_dump(str_replace("ab","","abcaasdfads"));?>
The official explanation is as follows
Grammar:
Str_replace (Find,replace,string,count)
Parameter description
Find: Required. Specifies the value to find.
Replace: Required. Specifies the value that replaces the value in Find.
String: Required. Specifies the string to be searched.
Count: Optional. A variable that counts the number of replacements.
In fact, the first is a small algorithm, can be limited to replace the number of characters, and the second is to replace all, according to the actual situation, the individual choice.
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes PHP in the string to find the specified string and delete the code, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.