中文字幕日韩一区二区_国产一区二区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( ) 主站蜘蛛池模板: 999久久久精品| 免费美女网站 | 免费看片在线播放 | 成人久久久久久久久 | 中文av电影| 久久久精品国产 | 久久伊人免费视频 | 天堂视频免费 | 黄色永久免费 | 美国黄色毛片 | 51ⅴ精品国产91久久久久久 | 久久精品国产99国产精品 | 精品久久国产老人久久综合 | 国产日韩一区 | 亚洲免费在线 | 日韩精品 电影一区 亚洲 | 成人免费淫片aa视频免费 | 中文字幕一区二区三区乱码在线 | 久久国产婷婷国产香蕉 | 久久久精品 | 国产精品不卡一区 | 欧美一区二区三区在线观看 | 国产一区二区三区四区五区加勒比 | 欧美 日韩 视频 | 国产精品99久久久久久久vr | 欧美成人一区二区三区 | 永久免费av | 日韩免费 | 欧美狠狠操 | 国产精品乱码一区二三区小蝌蚪 | 欧美日韩在线一区二区三区 | 国产高清精品一区二区三区 | 欧洲在线视频 | 日韩欧美一级精品久久 | 亚洲精品久久久久久久久久久久久 | 亚洲精品自在在线观看 | 日韩欧美在线视频观看 | 日本不卡一区 | 久久久夜夜夜 | 国产视频一二三区 | 亚洲国产aⅴ成人精品无吗 欧美激情欧美激情在线五月 |