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 ...
随机推荐
- python的map函数和reduce函数(转)
map函数 map()函数 map()是 Python 内置的高阶函数,它接收一个函数 f 和一个 list,并通过把函数 f 依次作用在 list 的每个元素上,得到一个新的 list 并返回. 例 ...
- window环境mysql解压版配置
1.下载并解压 到官网下载mysql-5.5.10-win32.zip,然后将mysql解压到任意路径,如:C:\mysql-5.5.10-win32 2.设置环境变量 打开计算机->属性-&g ...
- SpringCloud 简单理解
0.SpringCloud,微服务架构.包括 服务发现(Eureka),断路器(Hystrix),服务网关(Zuul),客户端负载均衡(Ribbon).服务跟踪(Sleuth).消息总线(Bus).消 ...
- Water Tree(树链剖分+dfs时间戳)
Water Tree http://codeforces.com/problemset/problem/343/D time limit per test 4 seconds memory limit ...
- 从RTTI谈C++的向下转型
转自:http://blog.chinaunix.net/uid-28541347-id-4251713.html 从RTTI谈C++的向下转型 1.什么是RTTI? RTTI 是“Runtime T ...
- css3阴影效果
http://blog.csdn.net/freshlover/article/details/7610269
- Asia Stock Exchanges[z]
Asia Stock Exchanges July 7, 2009 This article is to summarise the trading rules of some Asia stocke ...
- Django之virtualenv下安装xadmin
1.安装xadmin,通过pip 进入virtualenv pip安装xadmin pyyuc:~ yuchao$ source PycharmProjects/mxvenv/bin/activate ...
- 7.25 js 自定义方法 a.b
调用: $(function(){ Starinput.initiate({name:'qr1_z.startlevel',tar: $("#sitelogo1"), stars: ...
- 如何将网站部署到tomcat根目录下
更改前访问:http://192.168.1.2/baby 更改后访问:http://192.168.1.2/ 打开tomcat/conf/server.xml找到 <Host name=&qu ...