首先定义$a = "we are family";
笨笨的写法:
//将字符串分割成数组 $b = explode(" ",$a); //反转数组 $b = array_reverse($b); //将反转后的数组变为字符串 $a = implode(" ",$b);
可以将三行代码简化为一行代码~
$a = implode(" ",array_reverse(explode(" ",$a)));
发布于 2019-08-28 2.89k 次阅读
首先定义$a = "we are family";
笨笨的写法:
//将字符串分割成数组 $b = explode(" ",$a); //反转数组 $b = array_reverse($b); //将反转后的数组变为字符串 $a = implode(" ",$b);
可以将三行代码简化为一行代码~
$a = implode(" ",array_reverse(explode(" ",$a)));
Comments | NOTHING