PHP removes '#' from string

Guanhui
Release: 2023-04-08 18:28:01
Original
2760 people have browsed it

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!

Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!