一区二区久久-一区二区三区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( ) 主站蜘蛛池模板: 国产精品亚洲一区二区三区在线观看 | 久久丝袜精品中文字幕 | 哟哟色| 日韩欧美国产三级 | 超级碰碰青草免费视频92 | 日韩免费视频一区二区 | 精品国产91在线网 | 久久线看观看精品香蕉国产 | 国产永久在线视频 | 欧美一级欧美一级高清 | 亚洲综合图片网 | 国产a久久精品一区二区三区 | 一区二区三区在线免费视频 | 好吊色综合高清 | 天天摸天天爽视频69视频 | 99精选视频 | 欧美另类xxx| 国产一级一极性活片 | 欧洲精品码一区二区三区免费看 | 91亚洲国产系列精品第56页 | 久久久五月 | 黄色小视频在线看 | 亚洲成综合人影院在院播放 | 成年美女黄网站色大片视频 | 美女动作一级毛片 | 亚洲综合激情另类专区 | 国产91视频观看 | 日本精品久久久久中文字幕 1 | 小说区视频区 | 亚洲网色 | 97精品国产自在现线免费观看 | 韩国美女爽快一级毛片黄 | 黄色午夜视频 | 加勒比精品久久一区二区三区 | 国产精品一区二区久久 | 亚洲激情欧美 | 久久综合久久久久 | 成年网站未满十八禁毛片免费 | 一区二区三区视频 | 日韩免费视频一区二区 | 性亚洲无删减 |