What is the difference between ksort and asort in php?
Answer:
ksort - sorts an array by its key
asort - sorts an array by its value
Example.
<?php
$resource = array("d" => "answers", "a" => "php", "b" => "interview", "c" => "questions");
ksort($resource);
foreach ($resource as $key => $val) {
echo "$key = $val\n";
}
?>
The sample output is
a = php b = interview c = questions d = answers