中文字幕日韩一区二区_国产一区二区av_国产毛片av_久久久久国产一区_色婷婷电影_国产一区二区精品

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( ) 主站蜘蛛池模板: 亚洲美女天堂网 | www亚洲一区 | 国产福利二区 | 国产视频2021 | 国产精品久久久久久久久久 | 欧美一二三 | 亚洲精品久久久 | 国产精品69毛片高清亚洲 | 成人一区二 | 91视频在线 | 欧美日韩中文国产一区发布 | 色爱区综合 | 欧美激情精品久久久久久变态 | 中文字幕第十页 | 精品久久久久久亚洲精品 | 久久综合久色欧美综合狠狠 | www久久av| 自拍偷拍一区二区三区 | caoporn国产精品免费公开 | 日本午夜精品 | 黄色一级毛片 | 久久精品国产一区二区三区 | 欧美日韩中文国产一区发布 | 欧美一级欧美三级在线观看 | 久久久www成人免费无遮挡大片 | 日韩电影免费在线观看中文字幕 | 欧美国产日韩一区 | 一区二区视频在线观看 | 欧美精品首页 | 一本色道精品久久一区二区三区 | 精品一区二区三区四区五区 | 亚洲一二三在线观看 | 日本又色又爽又黄又高潮 | 中文无吗 | 伊人二区 | 91久久国产综合久久 | 亚洲欧美在线观看视频 | 久久精品无码一区二区三区 | 国产美女一区二区三区 | 操视频网站 | 国产在线视频一区 |