Home  >  Article  >  Backend Development  >  How to replace symbols in php

How to replace symbols in php

藏色散人
藏色散人Original
2020-12-02 10:07:492776browse

php method to replace symbols: first create a PHP sample file; then replace the # symbol with the ¥ symbol through the "str_replace("#", "¥", $str); method; finally output the replacement result That’s it.

How to replace symbols in php

The operating environment of this tutorial: Windows 7 system, PHP version 7.1. This method is suitable for all brands of computers.

Recommended: "PHP Video Tutorial"

php replacement symbol will replace # with ¥

$str = str_replace("#", "¥", $str);

str_replace() function Use a string to replace other characters in a string.

str_replace(find,replace,string,count)

Parameter description

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. A variable counting the number of substitutions.

This function is case sensitive. Please use str_ireplace() to perform a case-insensitive search.

Note: This function is binary safe.

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