PHP ksort() function with example
10 - Mar - 2022
XpertPhp
96
In this article, We will explain to you PHP ksort() function with example.
PHP ksort() function
The ksort() function is a built-in function of PHP. which is used to sort the array elements by the key in ascending order. so you can see our PHP array Function example.
Syntax
ksort(array, sorttype);
Example
<?PHP
$arr=array("d"=>"jay","a"=>"deep","b"=>"raj");
ksort($arr);
print_r($arr);
?>
Output
Array
(
[a] => deep
[b] => raj
[d] => jay
)