Get the App
SLTechnology News&Howtos  ›  Development  › 

How to remove Chinese colons by php

Shulou Source: shulou.com Published: 2022-06-01 13:22:59 09月21日 Update

This article "php how to remove Chinese colon" article knowledge point most people do not understand, so small editor to give you a summary of the following content, detailed content, clear steps, with a certain reference value, I hope you can read this article to gain something, let's take a look at this article "php how to remove Chinese colon" article bar.

In php, you can remove the Chinese colon by using the "preg_replace()" function, which is used to perform a search and replacement of a regular expression. When the parameter is set to "'/:/',"you can remove the Chinese colon. The syntax is"preg_replace ('/:/','$str)".

Operating environment: Windows 10 system, PHP 7.1 version, Dell G3 computer.

php how to remove Chinese colon

The preg_replace function performs a search and replace of a regular expression.

syntax

mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )

Search for parts of the subject that match the pattern and replace them with replacement.

Parameter Description:

$pattern: The pattern to search for, either a string or an array of strings.

$replacement: String or array of strings used for replacement.

$subject: The target string or array of strings to search for replacement.

$limit: Optional, maximum number of substitutions for each subject string for each pattern. The default is-1 (unlimited).

$count: optional, is the number of times the substitution is performed.

return value

If subject is an array, preg_replace() returns an array, otherwise a string.

If a match is found, the replaced subject is returned, otherwise the unchanged subject is returned. If an error occurs, NULL is returned.

Examples are as follows:

Output:

The above is about "php how to remove the Chinese colon" this article content, I believe everyone has a certain understanding, I hope the content shared by Xiaobian is helpful to everyone, if you want to know more related knowledge content, please pay attention to the industry information channel.

Tags: Character string colon Chinese content array search function parameter case article pattern number regularity knowledge article expression grammar maximum value Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Docker Microsoft macOS vpn