标题ksort
日期:2008-06-27    作者:semirock   来源:http://444p.com
文章打印自: PHP学习之家
访问文章完全地址: http://www.444p.com/example/php-function/aid2188-ksort/
头部广告
ksort
<HTML>
<HEAD>
<TITLE>ksort</TITLE>
</HEAD>
<BODY>
<?
$colors = array("red"=>"FF0000",
"green"=>"00FF00",
"blue"=>"0000FF");

// sort an array by its keys
ksort($colors);

// print out the values
for(reset($colors); $index=key($colors); next($colors))
{
print("$index : $colors[$index] <BR>\n");
}
?>
</BODY>
</HTML>