php str_replace character replacement and array replacement_PHP tutorial

WBOY
Release: 2016-07-20 11:02:30
Original
1149 people have browsed it

Usually the easiest thing is to replace characters

Such as: str_replace("#", "-", "dizaz#7#final"),

The more advanced thing is to save data and replace it.

str_replace(array('#', '$'), "-", "dizaz#7$final"), etc., these are the calling methods,

The other methods are the simplest in the php tutorial, and the other is to replace data with arrays

str_repace( array(1,2,3,4,5),'',array(6,7,8,9,10));

This is the replacement function.

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


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445356.htmlTechArticleGenerally the simplest is character replacement, such as: str_replace(#, -, dizaz#7#final), more advanced The only thing is to save the data and replace it. str_replace(array(#, $), -, dizaz#7$final) etc., just these adjustments...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!