Home  >  Article  >  Backend Development  >  PHP removes '#' from string

PHP removes '#' from string

Guanhui
GuanhuiOriginal
2020-06-05 17:09:022785browse

PHP removes '#' from string

PHP removes the "#" in the string

In PHP, you can use the "str_replace ()" function to replace the "#" in the string. #" removal. This function is used to replace substrings. Its syntax is "str_replace(search,replace,subject)". The removal method only needs to replace the "#" in the characters with empty characters.

Parameter description

If search and replace are arrays, then str_replace() will perform mapping replacement on subject. If the number of replace values ​​is less than the number of search values, additional replacements will be performed using empty strings. If search is an array and replace is a string, then the replacement of each element in search will always use this string. This conversion does not change case.

If search and replace are both arrays, their values ​​will be processed in sequence.

search

The target value to find, which is needle. An array can specify multiple targets.

replace

Replacement value for search. An array can be used to specify multiple replacements.

subject

Array or string to perform replacement. That is haystack.

If subject is an array, the replacement operation will traverse the entire subject, and the return value will also be an array.

count

If specified, its value will be set to the number of times replacement occurred.

Recommended tutorial: "PHP Tutorial"

The above is the detailed content of PHP removes '#' from string. 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