Home > Backend Development > PHP Tutorial > php字符轮换

php字符轮换

WBOY
Release: 2016-06-13 12:52:00
Original
885 people have browsed it

php字符替换
$str = "我是中国人sdfsfsfsdf php字符轮换 fsadfsf php字符轮换 ";
$ar  = array("a.jpg","b.jpg");

如果将 php字符轮换 替换成a.jpg
 php字符轮换 替换成b.jpg

形成"我是中国人sdfsfsfsdffsadfsf";


------解决方案--------------------
$keys=array('img1','img2');
echo strtr($str,array_combine($keys,$ar));

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