Home > Backend Development > PHP Tutorial > php sort_flags

php sort_flags

WBOY
Release: 2016-06-23 14:37:10
Original
918 people have browsed it

sort()

PHP sort() 函数用于对数组单元从低到高进行排序,如果成功则返回 TRUE,失败则返回 FALSE。

注意:本函数会为排序的数组中的单元赋予新的键名,这将删除原有的键名而不仅是重新排序。

语法:

bool sort( array &array [, int sort_flags] )
Copy after login

可选参数 sort_flags 用于改变排序的行为:

sort_flags 取值 说明
SORT_REGULAR 正常比较单元
SORT_NUMERIC 单元被作为数字来比较
SORT_STRING 单元被作为字符串来比较
SORT_LOCALE_STRING 根据当前的区域(locale)设置来把单元当作字符串比较
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template