倒装一个句子
作者:
我的楼兰0909 | 来源:发表于
2018-12-08 14:15 被阅读0次<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/6/19
* Time: 9:20
* 倒装一个句子,如:把"London bridge is falling down" 变成 "down falling is bridge London"
* 不使用额外的存储空间
*/
function aa($str){
$str = strrev($str);
$str = explode(' ',$str);
foreach($str as $k => $v){
$str[$k]=strrev($v);
}
return implode(' ',$str);
}
echo 'London bridge is falling down',"<br/>";
echo aa('London bridge is falling down');
die;//down falling is bridge London
本文标题:倒装一个句子
本文链接:https://www.haomeiwen.com/subject/tdyzcqtx.html
网友评论