<?php

 $characters = array('a','b','c','d','e','f');
arsort($characters);
print_r($characters);
/*
Array ( [5] => f [4] => e [3] => d [2] => c [1] => b [0] => a )
*/ $numbers = array(1,2,3,4,5,6,7,8);
arsort($numbers);
print_r($numbers);
/*
Array ( [7] => 8 [6] => 7 [5] => 6 [4] => 5 [3] => 4 [2] => 3 [1] => 2 [0] => 1 )
*/ $fruits = array('lemon' , 'orange' ,'banana' , 'apple');
arsort($fruits);
print_r($fruits);
/*
Array ( [1] => orange [0] => lemon [2] => banana [3] => apple )
*/ /*arsort()函数对中文的排序结果*/
$chinese = array('爱','本','吃','地');//ai-ben-chi-di
var_dump(arsort($chinese));
print_r($chinese);
/*
bool(true)
Array ( [0] => 爱 [1] => 本 [3] => 地 [2] => 吃 )
*/ $pingyin = array('ai','ben','chi','di');
arsort($pingyin);
print_r($pingyin);
/*
Array ( [3] => di [2] => chi [1] => ben [0] => ai )
*/
?>

结论:[单元索引关系不变,逆序排序]

  1.对英文字符排序是按照27个英文字母排列顺序进行逆序排列,单元索引关系保持不变;

  2.对数字排序是按照数字顺序进行逆序排列,单元索引关系保持不变;

问题:arsort()函数究竟是怎么对中文文字进行排序的

PHP Functions - arsort()的更多相关文章

  1. asp.net MVC helper 和自定义函数@functions小结

    asp.net Razor 视图具有.cshtml后缀,可以轻松的实现c#代码和html标签的切换,大大提升了我们的开发效率.但是Razor语法还是有一些棉花糖值得我们了解一下,可以更加强劲的提升我们 ...

  2. 【跟着子迟品 underscore】Array Functions 相关源码拾遗 & 小结

    Why underscore 最近开始看 underscore.js 源码,并将 underscore.js 源码解读 放在了我的 2016 计划中. 阅读一些著名框架类库的源码,就好像和一个个大师对 ...

  3. 【跟着子迟品 underscore】Object Functions 相关源码拾遗 & 小结

    Why underscore 最近开始看 underscore.js 源码,并将 underscore.js 源码解读 放在了我的 2016 计划中. 阅读一些著名框架类库的源码,就好像和一个个大师对 ...

  4. ajax的使用:(ajaxReturn[ajax的返回方法]),(eval返回字符串);分页;第三方类(page.class.php)如何载入;自动加载函数库(functions);session如何防止跳过登录访问(构造函数说明)

    一.ajax例子:ajaxReturn("ok","eval")->thinkphp中ajax的返回值的方法,返回参数为ok,返回类型为eval(字符串) ...

  5. QM模块包含主数据(Master data)和功能(functions)

    QM模块包含主数据(Master data)和功能(functions)   QM主数据   QM主数据 1 Material   Master MM01/MM02/MM50待测 物料主数据 2 Sa ...

  6. jQuery String Functions

    In today's post, I have put together all jQuery String Functions. Well, I should say that these are ...

  7. 2-4. Using auto with Functions

    在C++14中允许使用type deduction用于函数参数和函数返回值 Return Type Deduction in C++11 #include <iostream> using ...

  8. [Python] Pitfalls: About Default Parameter Values in Functions

    Today an interesting bug (pitfall) is found when I was trying debug someone's code. There is a funct ...

  9. Kernel Functions for Machine Learning Applications

    In recent years, Kernel methods have received major attention, particularly due to the increased pop ...

随机推荐

  1. Python 字符串操作,截取,长度

    1.字符串操作: 字符串长度: s = "; slen = len(s); 字符串截取: print s[:-:-] #截取,逆序隔1个取一个字符 print s[:-:-] #截取,逆序隔 ...

  2. Windows2008 IIS + .NET环境搭建指南

    Windows下最常用的网页服务器是自带的IIS,这里将为大家演示,windows2008下如何搭建IIS + .NET的动态网页环境. 环境配置:Qcloud 云服务器 windows 200864 ...

  3. 64位windows+32位JDK8+32位eclipse是可以的

  4. Web服务技术协议:REST与SOAP

    Web服务技术就有SOAP(Simple Object Access Protocol,简单对象访问协议)和REST(Representational State Transfer,表示性状态转移) ...

  5. java 错误: 找不到或无法加载主类

    这个问题应该很常见的,笔者经常手工编译一些测试代码或者小工具,经常用到 javac和java来编译并运行一些简单的小工具. 以Hello World来测试. HelloWorld.java publi ...

  6. 轮播图jQuery

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. tp5在apache下能访问,但放到nginx下报404

    index index.php index.html index.htm; if ( -f $request_filename) { break; } if ( !-e $request_filena ...

  8. Hadoop 系列(一)基本概念

    Hadoop 系列(一)基本概念 一.Hadoop 简介 Hadoop 是一个由 Apache 基金会所开发的分布式系统基础架构,它可以使用户在不了解分布式底层细节的情況下开发分布式程序,充分利用集群 ...

  9. c++中嵌套类,外部类访问内部类的私有成员变量

    在嵌套类中,内部类可以直接访问外部类的私有成员变量,但是外部类不能直接访问内部类的私有成员变量,必须把外部类声明为内部类的友元类 /********************************** ...

  10. 2018.07.03 POJ 1279Art Gallery(半平面交)

    Art Gallery Time Limit: 1000MS Memory Limit: 10000K Description The art galleries of the new and ver ...