怎么写一段函数实现字符串的翻转?只改变单词顺序,不要所有字母倒序

WBOY
Release: 2016-06-13 12:05:37
Original
1263 people have browsed it

如何写一段函数实现字符串的翻转?只改变单词顺序,不要所有字母倒序!
如何将字符串倒序,如"I love you" 变成"you love I",只翻转句子顺序,不翻转字母的?
------解决方案--------------------

$string="I love you";<br />echo implode(array_reverse(explode(" ",$string))," ");
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template