ksort ( $array, $sort_flag );
函数的作用是:按键对数组进行排序,维护数据相关性的键。这主要适用于关联数组。
Sr.No | Parameter & Description |
---|---|
1 |
array 必填。指定数组 |
2 |
sort_flag 可选。指定如何对数组值进行排序。可能的值-
|
此函数成功时返回TRUE,失败时返回FALSE。
链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-ksort.html
来源:LearnFk无涯教程网
<?php $transport=array( a=>'foot', b=>'bike', c=>'car', d=>'plane'); ksort($transport); print_r($transport); ?>
这将产生以下输出-
Array ( [a] => foot [b] => bike [c] => car [d] => plane )
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)