Home  >  Article  >  Backend Development  >  How to remove characters in php

How to remove characters in php

藏色散人
藏色散人Original
2020-05-19 11:16:503302browse

How to remove characters in php

How to remove characters in php?

If you don’t have Chinese, you can use str_replace

str_replace(find,replace,string,count)

str_replace() The function replaces some characters in the string with other characters ( Case sensitive)

Parameters

find Required. Specifies the value to look for.

replace Required. Specifies the value to replace the value in find.

string Required. Specifies the string to be searched for.

count Optional. Variable counting the number of substitutions.

Example: Replace the character "world" in the string "Hello world!" with "Shanghai"

echo str_replace("world","Shanghai","Hello world!");

Output result:

Hello Shanghai!

Recommendation: " PHP tutorial

The above is the detailed content of How to remove characters 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
Previous article:What does -> mean in phpNext article:What does -> mean in php