Home > Backend Development > PHP Problem > How to replace symbols in php

How to replace symbols in php

藏色散人
Release: 2023-03-07 22:40:01
Original
2842 people have browsed it

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);
Copy after login

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

str_replace(find,replace,string,count)
Copy after login

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!

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