首页  >  文章  >  后端开发  >  PHP函数Ksort()通过关键字对数组进行排序的具体方式介绍_PHP教程

PHP函数Ksort()通过关键字对数组进行排序的具体方式介绍_PHP教程

WBOY
WBOY原创
2016-07-15 13:29:441278浏览

我们在学习Listing C的具体代码如下:

<ol class="dp-xml">
<li class="alt"><span><strong><font color="#006699"><span class="tag"></span><span class="tag-name">php</span></font></strong><span> </span></span></li>
<li class="alt"><span><span>$</span><span class="attribute"><font color="#ff0000">data</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">array</font></span><span>("US" =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> "United States", <br>"IN" =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> "India", "DE" =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> "Germany", "ES" =</span><span class="tag"><strong><font color="#006699">></font></strong></span><span> <br>"Spain");ksort($data); print_r($data);  </span></span></li>
<li class="">
<span></span><span class="tag"><strong><font color="#006699">?></font></strong></span><span> </span>
</li>
</ol>

它的输出结果如下:

Array ([DE] => Germany

[ES] => Spain

[IN] => India

[US] => United States

)

通过上面例子的介绍,希望大家能清楚PHP函数Ksort()的具体使用。


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/446350.htmlTechArticle我们在学习 Listing C的具体代码如下: ? php $ data = array ("US"= "UnitedStates", "IN"= "India","DE"= "Germany","ES"= "Spain");ksort($data);print_r($data); ? 它的输出...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn