Home  >  Article  >  Backend Development  >  Detailed explanation of the functional features of PHP function arsort()_PHP Tutorial

Detailed explanation of the functional features of PHP function arsort()_PHP Tutorial

WBOY
WBOYOriginal
2016-07-15 13:29:481156browse

Everyone is learningThe following Listing F code is an example of using the PHP function arsort():

<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><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", "IN" <br>=</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");arsort($data); print_r($data);  </span>
</li>
<li class=""><span class="tag"></span></li>
<li class="">
<span></span><span class="tag"><strong><font color="#006699">?></font></strong></span><span> </span>
</li>
</ol>

The following is its output, sorted alphabetically by value. Comparing the following results with the results generated after inversion using the krsort() function, you can easily understand the difference between the two.

Array ([US] => United States

[ES] => Spain

[IN] => India

[DE] => Germany

)

The example introduced above is the specific use of the PHP function arsort().


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446348.htmlTechArticleEveryone is studying the following Listing F code which is an example of using the PHP function arsort(): ? php $ data = array ("US"= "UnitedStates","IN" = "India","DE"= "Germany","ES"= "Spain");arsort($d...
Statement:
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