PHP ksort() ຫົວຂໍ້ກຳລັງກວດສອບ
ການຄົ້ນຄວ້າ
ການຂັ້ນວັດຖຸຄຳມະນາວິນປະຕິບັດຢ່າງຂື້ນກັນຂອງອອກສາຍການລະບຸຄຳມະນາວິນ:
<?php $age=array("Bill"=>"60","Steve"=>"56","mark"=>"31"); ksort($age); ?>
ການສະເໜີ ແລະ ການນໍາໃຊ້
ksort() ຫົວຂໍ້ກຳລັງກວດສອບອອກສາຍການລະບຸຄຳມະນາວິນປະຕິບັດຢ່າງຂື້ນກັນ.
Tip:Please use krsort() The function sorts the associated array in descending order by key name.
Tip:Please use asort() The function sorts the associated array in ascending order by value.
Syntax
ksort(array,sortingtype);
Parameters | Description |
---|---|
array | Required. Specify the array to be sorted. |
sortingtype |
Optional. Specify how to arrange the elements/items of the array. Possible values:
|
Description
The ksort() function sorts an array by key name, keeping the original keys of the array values.
The optional second parameter includes additional sorting flags.
Returns TRUE if successful, otherwise returns FALSE.
Technical Details
Return Value: | Returns TRUE if successful, otherwise returns FALSE. |
PHP Version: | 4+ |