我們在學習Listing C的具體代碼如下:
- <?php
- $data = array("US" => "United States",
"IN" => "India", "DE" => "Germany", "ES" =>
"Spain");ksort($data); print_r($data);- ?>
它的輸出結果如下:
Array ([DE] => Germany
[ES] => Spain
[IN] => India
[US] => United States
)
通過上面例子的介紹,希望大家能清楚PHP函數Ksort()的具體使用。