Introduction to the specific method of PHP function Ksort() to sort arrays by keywords_PHP Tutorial

WBOY
Release: 2016-07-15 13:29:44
Original
1248 people have browsed it

We are learningThe specific code of Listing C is as follows:

<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 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>></span></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>
</li>
<li class="">
<span></span><span class="tag"><strong><font color="#006699">?></font></strong></span><span> </span>
</li>
</ol>
Copy after login

its The output is as follows:

Array ([DE] => Germany

[ES] => Spain

[IN] => India

[US] => United States

)

Through the introduction of the above example, I hope everyone can understand the specific use of the PHP function Ksort().


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446350.htmlTechArticleThe specific code we are learning Listing C is as follows: ? php $ data = array ("US" = "UnitedStates" , "IN"= "India","DE"= "Germany","ES"= "Spain");ksort($data);print_r($data); ? Its output...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!