|
$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精品嗷嗷嗷嗷 | 好姑娘社区在线视频 | 国产69精品久久久久人妻刘玥 | 婷婷五月久久丁香国产综合 | 同桌上课把奶露出来给我玩 | 美女议员被泄裸照 | 漂亮美女2018完整版 | a在线免费观看视频 | 久久久久久久久久毛片精品美女 | 啊叫大点声欠CAO的SAO贷 | 成3d漫二区三区四区 | 亚洲精品AV中文字幕在线 | 色尼玛亚洲综合 | 帝王受PLAY龙椅高肉NP | 美女张开腿露出尿口扒开来摸动漫 | 校草让我脱了内裤给全班看 | 美女久久久 | 视频区 国产 欧美 日韩 | 好男人的视频在线观看 | 在线播放日韩欧美亚洲日本 | 白丝女仆被啪到深夜漫画 | 九色PORNY丨视频入口 | 午夜宅宅伦电影网 | 99久久国语露脸精品国产 | 欧美日韩亚洲成人 | 亚洲日本一区二区三区在线不卡 | 射漂亮黑b丝女 | 免费看午夜高清性色生活片 | 51国产偷自视频在线视频播放 | 久久国产欧美日韩精品免费 | 国产中文字幕乱码免费 | 麻豆XXXX乱女少妇精品 | 在线亚洲精品福利网址导航 | 啊灬啊别停灬用力啊在线观看视频 | 亚洲国产黄色 | 绝对诱惑在线试听 | 欧美日韩888在线观看 | 日本在线高清不卡免费播放 |