ksort

It sorts an array by key

Example

<?php
echo “<pre>”;
$lan = array(2=>”PHP”,1=> “ASP”, 3=>”JSP”);
ksort($lan);
print_r($lan);
?>

Output

Array
(
[1] => ASP
[2] => PHP
[3] => JSP
)

Share