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>
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().