Home>Article>Backend Development> How to delete specified string in php string
php method to delete a specified string in a string: 1. Use the strpos function to find the position of the string; 2. Use the strlen function to calculate the length of the string; 3. Use the substr_replace function to replace the specified string. Can.
Related function introduction:
(Recommended tutorial:php video tutorial)
## The #strlen() function returns the length of the string. The strpos() function finds the first occurrence of a string in another string (case sensitive). The substr_replace() function replaces part of a string with another string. Implementation code:$ex = 'http://img.path.com'; $email= 'http://img.path.com/uploads/20190723/c700499be56d6a97c32985bda0c7745b.png'; $count=strpos($email,"$ex"); $strlen = strlen($ex); $str=substr_replace($email,"",$count,$strlen); echo $str;Related recommendations:
The above is the detailed content of How to delete specified string in php string. For more information, please follow other related articles on the PHP Chinese website!