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

php字符轮换

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:17:04
Original
783 people have browsed it

php字符替换
$str = "我是中国人sdfsfsfsdfphp字符轮换fsadfsfphp字符轮换";
$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