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

How to clear characters in php

藏色散人
藏色散人Original
2020-07-31 09:07:102194browse

php method to clear characters: first create a PHP sample code file; then enter the content "$str="abcdefg"; $str=str_replace('a','',$str);"; finally Just output the cleared result through echo.

How to clear characters in php

Recommended: "PHP Video Tutorial"

php removes a character from a string:

Just replace it with a string. Just replace the characters you want to replace with nothing.

For example:

Your original string is "abcdefg", and you want to remove the a in it, you can use the following method

$str="abcdefg";
$str=str_replace('a','',$str);
echo $str;

The above is the detailed content of How to clear 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