:: 提取数组排序。
例如)TEST_DATA.DB
1/korea/5000/word 1
10/japan/25000/word 10
21/china/130000/word 21
2/usa/35000/word 2
<?php
$DB4_DATABASE = "TEST_DATA.DB4";
$DIV = "/";
$_FILE = "$DATA_DIR/HUTM_NETWORK_ROUTER.DB"; $db = dba_open($DB4_DATABASE,"r","db4");
$key = dba_firstkey($db);
$ii = 0;
while($key != NULL)
{
$LIST[$ii] = explode($DIV,dba_fetch($key, $db)); $key = dba_nextkey($db);
$ii++;
}
dba_close($db);
$total = $ii; sort($LIST,SORT_NUMERIC); for($i=0;$i<$total;$i++)
{
$oData = explode($DIV,$LIST[$i]); $key = trim(chop($oData[0])); $name = trim(chop($oData[1])); $count = trim(chop($oData[2])); $word = trim(chop($oData[3])); echo "$key / $name / $count / $word <br>\r\n";
}
?>
:: 结果:
1/korea/5000/word 1
2/usa/35000/word 2
10/japan/25000/word 10
21/china/130000/word 21