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 ...
随机推荐
- JavaScript实现AOP(面向切面编程,装饰者模式)
什么是AOP? AOP(面向切面编程)的主要作用是把一些跟核心业务逻辑模块无关的功能抽离出来,这些跟业务逻辑无关的功能通常包括日志统计.安全控制.异常处理等.把这些功能抽离出来之后, 再通过“动态织入 ...
- java 用volatile和不用volatile的区别
在当前的Java内存模型下,线程可以把变量保存在本地内存(比如机器的寄存器)中,而不是直接在主存中进行读写.这就可能造成一个线程在主存中修改了一个变量的值,而另外一个线程还继续使用它在寄存器中的变量值 ...
- scanf与printf
scanf格式控制的完整格式: % * m l或h 格式字符 ①格式字符与printf函数中的使用方式相同,以%d.%o.%x.%c.%s.%f.%e,无%u格式.%g ...
- 中文路径读取乱码,json乱码
strPath = 'E:\新建文件夹' #含有中文的路径,使用unicode函数转换. strPath = unicode(strPath , "utf8") 参考:http:/ ...
- html标签的总结-重复
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- python内置函数之attr【反射】
#Auther Bob#--*--conding:utf-8 --*-- #我们来循序渐进的学习反射 import s1 #阶段1# def run():# url = input("请输入 ...
- swift 官方文档
swift 官方文档 https://swift.org/blog/
- 4-QT的程序打包发布(将QT5的工程项目打包成一个exe程序)
https://blog.csdn.net/windsnow1/article/details/78004265 最近,在学习QT5的过程中,想尝试着把自己写的工程程序给打包发布出来,在任何一台win ...
- .Net多线程 并行编程(三)---并行集合
为了让共享的数组,集合能够被多线程更新,我们现在(.net4.0之后)可以使用并发集合来实现这个功能. 而System.Collections和System.Collections.Generic命名 ...
- AdmBaseController 判断是否登录
代码 using Service.IService; using System; using System.Collections.Generic; using System.Linq; using ...