<?php echo "<pre>"; $input = array("php","mysql",array("green","red")); $result = array_reverse($input); //反向排序,不保留数字键 $result_keyed = array_reverse($input,true); //反向排序,保留原来的数字键 var_dump($input); /* 输出:array(3){[0]=>string(3)"php" [1]=>string(5)"mysql" [2]=>array(2){[0]=>string(5)"green" [1]=>string(3) "red"}} */ echo '<br />'; var_dump($result); /* 输出:array(3){[0]=>array(2){[0]=>string(5)"green" [1]=>string(3)"red"} [1]=>string(5)"mysql" [2]=>string(3)"php"} */ echo '<br />'; var_dump($result_keyed); /* 输出:array(3){[2]=>array(2){[0]=>string(5)"green" [1]=>string(3)"red"} [1]=>string(5)"mysql" [0]=>string(3)"php"} */