一区二区久久-一区二区三区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( ) 主站蜘蛛池模板: 四虎永久免费地址在线观看 | 天天澡天天摸天天爽免费 | 中文一区二区 | 亚洲日本一区二区三区在线 | 色忧忧| 国内精品久久久久影院不卡 | 五月天激情社区 | 欧美成人福利 | 久久精品国产亚洲a | 伊人色综| 美妇乱人伦性 | 日本韩国三级在线 | 国产小视频国产精品 | 都市激情综合网 | 91精品国产自产在线观看 | 国产亚洲一区呦系列 | 亚洲成a人片在线v观看 | 91国内视频在线观看 | 另类小说图片 | 成年黄网站色视频免费观看 | 国产在线精品福利大全 | 一级做a爰片久久毛片美女 一级做a爰片久久毛片人呢 | 国产精品亚洲小说专区 | 国产福利在线免费观看 | 91热视频在线观看 | 香蕉视频成人在线观看 | 一区二区三区四区视频在线 | 青青国产成人久久激情911 | 狠狠色成人综合首页 | 看免费人成va视频全 | 午夜在线视频免费观看 | 91黄色在线观看 | 国产自产精品 | 91精品啪在线看国产网站 | 91久久综合 | 国产精品成人第一区 | 亚洲爽视频 | 亚洲线精品久久一区二区三区 | 91中文字幕在线一区 | 丁香六月在线视频 | 日韩香蕉网 |