一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

Sorting Array Values in PHP(數組排序)

復制代碼 代碼如下:
$full_name = array();
$full_name["Roger"] = "Waters";
$full_name["Richard"] = "Wright";
$full_name["Nick"] = "Mason";
$full_name["David"] = "Gilmour";

To sort this array, you just use the assort( ) function. This involves nothing more complex than typing the word asort, followed by round brackets. In between the round brackets, type in the name of your Associative array:
復制代碼 代碼如下:
asort($full_name);

The letter "a" tells php that the array is an Associative one. (If you don't have the "a" before "sort", your key names will turn in to numbers!). The "a" also tells php to sort by the Value, and NOT by the key. In our script above, the surnames will be sorted. If you want to sort using the Key, then you can use ksort() instead.

If you have a Scalar array (numbers as Keys), then you leave the "a" off. Like this:
復制代碼 代碼如下:
$numbers = array( );
$numbers[]="2";
$numbers[]="8";
$numbers[]="10";
$numbers[]="6";
sort($numbers);
print $numbers[0] ;
print $numbers[1];
print $numbers[2] ;
print $numbers[3];

The numbers are then sorted from lowest to highest. If you want to sort in reverse order then you need the following:

rsort( ) 主站蜘蛛池模板: 成人91视频 | 国产一区二区高清在线 | 在线看一区 | 日本视频网站在线www色 | 天天干天天操天天舔 | 亚洲欧洲日韩国产一区二区三区 | 婷婷六月天激情 | 亚洲一区二区色 | 国产情侣91 | 五月丁香六月综合缴清无码 | 伊人网色| 蜜臀91精品国产免费观看 | 国产视频福利 | 大色皇大久久大久久 | 美女视频黄.免费网址 | 成人免费观看视频高清视频 | 一区二区三区四区精品 | 国产精品永久免费视频观看 | 激情婷婷成人亚洲综合 | 日韩视频一区二区三区 | 六月婷婷在线 | 一区二区三区四区在线视频 | 永久免费观看午夜视频在线 | 2020天堂中文字幕一区在线观 | 亚洲一区不卡 | 欧美成人天天综合在线视色 | 亚洲午夜色 | 97香蕉超级碰碰碰久久兔费 | 91精品国产人成网站 | 国产精品欧美在线 | 国产一二三在线观看 | 久久精品国产精品青草不卡 | 中文字幕精品视频在线观 | 亚洲免费精品视频 | 91福利视频网站 | 欧美特黄一片aa大片免费看 | 国产最新精品 | 视频一区视频二区在线观看 | 极品美女国产精品免费一区 | 成人特黄午夜性a一级毛片 成人婷婷 | 一二三四在线播放免费视频中国 |