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

Sorting Array Values in PHP(數(shù)組排序)

復(fù)制代碼 代碼如下:
$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:
復(fù)制代碼 代碼如下:
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:
復(fù)制代碼 代碼如下:
$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在线视频免费91 | 一级做a爰片性色毛片2021 | 综合久久综合 | 成人精品福利 | 激情欧美一区二区三区中文字幕 | www.国产.com| 香蕉久久精品 | 看一级毛片国产一级毛片 | 久久91精品国产91久久小草 | 亚洲欧美日韩精品在线 | 中国a毛片| 男人扒开女人腿使劲桶动态图 | 四虎影视国产884a精品亚洲 | 久久精品青草社区 | 午夜免费的国产片在线观看 | 香蕉视频国产精品 | 欧美人禽杂交狂配在线观看视频 | 日韩视频第一页 | 欧美极品第一页 | 伊人久久五月 | 国产婷婷成人久久av免费高清 | 欧美成人观看 | 国产成人精品一区二区三区 | 555夜色555亚洲夜色 | 99午夜视频| 四虎影视永久在线精品免费 | 欧美精品第二页 | 黄a级网站在线观看 | 国产精品手机在线亚洲 | 极品美女一区二区三区 | 国产美女白丝袜精品_a不卡 | 久久网综合 | 国产伦理久久精品久久久久 | 国产一区在线观看视频 | 日本精品一区二区在线播放 | 日本乱人伦片中文三区 |