php字符轮换

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:17:04790browse

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));

Statement:
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