arr1(1,2,3,4,5,6,7,8,9,10)存储到数组arr2()为arr2(10,9,8,7,6,5,4,3,2,1)
<?php
$arr1=array(1,2,3,4,5,6,7,8,9);
print_r($arr1) ;
$arr2 = array();
for($i=0;$i<count($arr1);$i++){
$arr2[count($arr1)-$i-1]=$arr1[$i];
}
echo "</br>";
print_r($arr2) ;
?>
我这只能倒叙键名,求大神指教
(1)<?php
$arr1=array(1,2,3,4,5,6,7,8,9);
print_r($arr1) ;
$arr_value=array_values($arr1);
$arr2 = array();
for($i=1;$i<=count($arr1);$i++){
$arr2[count($arr1)-$i]=$arr_value[count($arr1)-$i];
}
echo "</br>";
print_r($arr2) ;
?>
Helenr
守着星空守着你
SMILET