search
Homephp教程php手册PHP的排序函数的总结

Sort     破坏索引 升序    值排序

Rsort    破坏索引 降序    值排序

 

Asort    保持索引 升序     值排序

Arsort   保持索引 降序     值排序

 

Ksort    保持索引 升序      键值排序(key)

Krsort   保持索引 降序       键值排序(key)

 

Usort

本函数将用用户自定义的比较函数对一个数组中的值(value)进行排序。如果要排序的数组需要用一种不寻常的标准进行排序,那么应该使用此函数。

比较函数必须在第一个参数被认为小于,等于或大于第二个参数时分别返回一个小于,等于或大于零的整数。

Uksort

uksort — 使用用户自定义的比较函数对数组中的键名(key)进行排序

cmp_function 函数应接受两个参数,该参数将被 array 中的一对键名填充。比较函数在第一个参数小于,等于,或大于第二个参数时必须分别返回一个小于零,等于零,或大于零的整数。

Natsort

本函数实现了一个和人们通常对字母数字字符串进行排序的方法一样的排序算法并保持原有键/值的关联,这被称为“自然排序”。本算法和通常的计算机字符串排序算法

 

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.