Home > php教程 > php手册 > php str_replace字符替换与数组替换

php str_replace字符替换与数组替换

WBOY
Release: 2016-06-02 09:14:14
Original
1177 people have browsed it

一般最简单就是字符替换了,如:str_replace("#", "-", "dizaz#7#final"),更高级的就是保存数据替换了,代码如下:

str_replace(array('#', '$'), "-", "dizaz#7$final") 等,就这些调用方式,其它这些方法在php中最非常简单的,还有就是数组替换数据,代码如下:

str_repace( array(1,2,3,4,5),'',array(6,7,8,9,10));这就是替换函数.

下面一个PHP实例代码:

$object = "dizaz#7#final"; 
$res = str_replace("#", "-", $object); 
echo $res;
Copy after login


永久链接:

转载随意!带上文章地址吧。

Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template