Home>Article>Backend Development> Examples of application of krsort and asort functions in php array sorting

Examples of application of krsort and asort functions in php array sorting

WBOY
WBOY Original
2016-07-25 08:58:50 1047browse
  1. $my_array = array("a" => "Dog", "b" => "Cat", "c" => "Horse");
  2. krsort($ my_array);
  3. print_r($my_array);
  4. ?>
Copy code

output:

  1. $my_array = array("a" => "Dog", "b" => "Cat", "c" => "Horse" );

  2. Array (
  3. => Cat [a] => Dog [c] => Horse )
  4. >>> For more information, please view the complete list of php array sorting methods

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn