PHP Functions - arsort()
<?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()的更多相关文章
- asp.net MVC helper 和自定义函数@functions小结
asp.net Razor 视图具有.cshtml后缀,可以轻松的实现c#代码和html标签的切换,大大提升了我们的开发效率.但是Razor语法还是有一些棉花糖值得我们了解一下,可以更加强劲的提升我们 ...
- 【跟着子迟品 underscore】Array Functions 相关源码拾遗 & 小结
Why underscore 最近开始看 underscore.js 源码,并将 underscore.js 源码解读 放在了我的 2016 计划中. 阅读一些著名框架类库的源码,就好像和一个个大师对 ...
- 【跟着子迟品 underscore】Object Functions 相关源码拾遗 & 小结
Why underscore 最近开始看 underscore.js 源码,并将 underscore.js 源码解读 放在了我的 2016 计划中. 阅读一些著名框架类库的源码,就好像和一个个大师对 ...
- ajax的使用:(ajaxReturn[ajax的返回方法]),(eval返回字符串);分页;第三方类(page.class.php)如何载入;自动加载函数库(functions);session如何防止跳过登录访问(构造函数说明)
一.ajax例子:ajaxReturn("ok","eval")->thinkphp中ajax的返回值的方法,返回参数为ok,返回类型为eval(字符串) ...
- QM模块包含主数据(Master data)和功能(functions)
QM模块包含主数据(Master data)和功能(functions) QM主数据 QM主数据 1 Material Master MM01/MM02/MM50待测 物料主数据 2 Sa ...
- jQuery String Functions
In today's post, I have put together all jQuery String Functions. Well, I should say that these are ...
- 2-4. Using auto with Functions
在C++14中允许使用type deduction用于函数参数和函数返回值 Return Type Deduction in C++11 #include <iostream> using ...
- [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 ...
- Kernel Functions for Machine Learning Applications
In recent years, Kernel methods have received major attention, particularly due to the increased pop ...
随机推荐
- oracle 理解执行计划
·BUFFER SORT是BUFFER却不是SORT 用AUTOTRACE查看执行的计划的同学常问到执行计划里的BUFFER SORT是什么意思,这里为什么要排序呢? BUFFER SORT不是一种排 ...
- oozie错误:javax.servlet.jsp.el.ELException: variable [***] cannot be resolved
完整错误: javax.servlet.jsp.el.ELException: variable [compute] cannot be resolved at org.apache.oozie.ut ...
- InnoDB FULLTEXT
1.概要 InnoDB引擎对FULLTEXT索引的支持是MySQL5.6新引入的特性,之前只有MyISAM引擎支持FULLTEXT索引.对于FULLTEXT索引的内容可以使用MATCH()…AGAIN ...
- 根据数组下标在MongoDB中修改数组元素
如下图这样的数据: 即文档中某个字段是一个数组,而每个数组元素又是一个对象,现在需求是对每个对象中的content字段值作情感分析后,把情感分析得到的结果增加到这个对象中去. 如上图中第1个元素,修改 ...
- jQuery源码解读三选择器
直接上jQuery源码截取代码 // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ i ...
- python简单基础代码
1.从键盘输入两个数,并计算A的B次幂:number1=raw_input('input number1:')number2=raw_input('input number2:')print 'num ...
- IIS7web服务器调试ASP.net程序遇到的一些故障的解决办法
1. [由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面] 故障描述:[由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面] ...
- Spring框架的AOP技术(注解方式)
1. 步骤一:创建JavaWEB项目,引入具体的开发的jar包 * 先引入Spring框架开发的基本开发包 * 再引入Spring框架的AOP的开发包 * spring的传统AOP的开发的包 * sp ...
- Linq和EF 做 单一条件查询 和 复合条件 查询 以及 多表 联合查询 示例
单一条件查询: var table2Object = (from t1 in db.table1 join t2 in db.table2 on t1.id equals t2.id select t ...
- SqlDataHelper
using System;using System.Data;using System.Configuration;using System.Linq;using System.Web;using S ...