我有一个类似......
的数组Array ( [0] => 'Mon' [1] => 'Sun' [2] => 'Sat' [3] => 'Fri' [4] => 'Thu' [5] => 'Wed' [6] => 'Tue' )
我想要如下......
Array ( [0] => 'Tue' [1] => 'Wed' [2] => 'Thu' [3] => 'Fri' [4] => 'Sat' [5] => 'Sun' [6] => 'Mon' )
答案 0 :(得分:0)
$a= your array;
$y = array_reverse($a);
$ y将返回您的预期输出。希望这可以帮助您
答案 1 :(得分:0)
您应该使用array_reverse()
$arr = array(0 => 'Mon', 1 => 'Sun', '2' => 'Sat', 3 => 'Fri', 4 => 'Thu');
$newArr = array_reverse($arr);
print_r($newArr);
输出:
Array ( [0] => Thu [1] => Fri [2] => Sat [3] => Sun [4] => Mon )