ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
数组函数: * [array\_change\_key\_case](https://www.php.net/manual/en/function.array-change-key-case.php)—更改数组中所有键的大小写 * [array\_chunk](https://www.php.net/manual/en/function.array-chunk.php)—将数组拆分为多个块 * [array\_column](https://www.php.net/manual/en/function.array-column.php)—从输入数组中的单个列返回值 * [array\_combine](https://www.php.net/manual/en/function.array-combine.php)—通过使用一个数组作为键并使用另一个数组作为其值来创建数组 * [array\_count\_values](https://www.php.net/manual/en/function.array-count-values.php)—计算数组的所有值 * [array\_diff\_assoc](https://www.php.net/manual/en/function.array-diff-assoc.php)—使用附加索引检查来计算数组的差 * [array\_diff\_key](https://www.php.net/manual/en/function.array-diff-key.php)—使用比较键计算数组的差 * [array\_diff\_uassoc](https://www.php.net/manual/en/function.array-diff-uassoc.php)—通过由用户提供的回调函数执行的附加索引检查来计算数组的差值 * [array\_diff\_ukey](https://www.php.net/manual/en/function.array-diff-ukey.php)—使用键上的回调函数计算数组的差异以进行比较 * [array\_diff](https://www.php.net/manual/en/function.array-diff.php)—计算数组的差 * [array\_fill\_keys](https://www.php.net/manual/en/function.array-fill-keys.php)—用值填充数组,指定键 * [array\_fill](https://www.php.net/manual/en/function.array-fill.php)—用值填充数组 * [array\_filter](https://www.php.net/manual/en/function.array-filter.php)—使用回调函数过滤数组的元素 * [array\_flip](https://www.php.net/manual/en/function.array-flip.php)—交换数组中所有键及其关联的值 * [array\_intersect\_assoc](https://www.php.net/manual/en/function.array-intersect-assoc.php)—计算带有附加索引检查的数组的交集 * [array\_intersect\_key](https://www.php.net/manual/en/function.array-intersect-key.php)—使用比较键计算数组的交集 * [array\_intersect\_uassoc](https://www.php.net/manual/en/function.array-intersect-uassoc.php)—计算具有附加索引检查的数组的交集,通过回调函数比较索引 * [array\_intersect\_ukey](https://www.php.net/manual/en/function.array-intersect-ukey.php)—在键上使用回调函数计算数组的交集 * [array\_intersect](https://www.php.net/manual/en/function.array-intersect.php)—计算数组的交集 * [array\_key\_exists](https://www.php.net/manual/en/function.array-key-exists.php)—检查数组中是否存在给定的键或索引 * [array\_key\_first](https://www.php.net/manual/en/function.array-key-first.php)—获取数组的第一个键 * [array\_key\_last](https://www.php.net/manual/en/function.array-key-last.php)—获取数组的最后一个键 * [array\_keys](https://www.php.net/manual/en/function.array-keys.php)—返回数组的所有键或键的子集 * [array\_map](https://www.php.net/manual/en/function.array-map.php)—将回调应用于给定数组的元素 * [array\_merge\_recursive](https://www.php.net/manual/en/function.array-merge-recursive.php)—递归合并一个或多个数组 * [array\_merge](https://www.php.net/manual/en/function.array-merge.php)—合并一个或多个数组 * [array\_multisort](https://www.php.net/manual/en/function.array-multisort.php)—对多维或多维数组进行排序 * [array\_pad](https://www.php.net/manual/en/function.array-pad.php)—使用值将数组填充到指定的长度 * [array\_pop](https://www.php.net/manual/en/function.array-pop.php)—从数组末尾弹出元素 * [array\_product](https://www.php.net/manual/en/function.array-product.php)—计算数组中值的乘积 * [array\_push](https://www.php.net/manual/en/function.array-push.php)—将一个或多个元素推到数组的末尾 * [array\_rand](https://www.php.net/manual/en/function.array-rand.php)—从数组中选择一个或多个随机键 * [array\_reduce](https://www.php.net/manual/en/function.array-reduce.php)—使用回调函数将数组迭代地减少为单个值 * [array\_replace\_recursive](https://www.php.net/manual/en/function.array-replace-recursive.php)—将传递的数组中的元素递归替换为第一个数组 * [array\_replace](https://www.php.net/manual/en/function.array-replace.php)—将传递的数组中的元素替换为第一个数组 * [array\_reverse](https://www.php.net/manual/en/function.array-reverse.php)—返回具有相反顺序元素的数组 * [array\_search](https://www.php.net/manual/en/function.array-search.php)—在数组中搜索给定值,如果成功,则返回第一个对应的键 * [array\_shift](https://www.php.net/manual/en/function.array-shift.php)—将元素移出数组的开头 * [array\_slice](https://www.php.net/manual/en/function.array-slice.php)—提取数组的一部分 * [array\_splice](https://www.php.net/manual/en/function.array-splice.php)—删除数组的一部分并将其替换为其他内容 * [array\_sum](https://www.php.net/manual/en/function.array-sum.php)—计算数组中值的总和 * [array\_udiff\_assoc](https://www.php.net/manual/en/function.array-udiff-assoc.php)—通过附加索引检查计算数组的差,通过回调函数比较数据 * [array\_udiff\_uassoc](https://www.php.net/manual/en/function.array-udiff-uassoc.php)—通过附加索引检查来计算数组的差,通过回调函数比较数据和索引 * [array\_udiff](https://www.php.net/manual/en/function.array-udiff.php)—通过使用回调函数进行数据比较来计算数组的差 * [array\_uintersect\_assoc](https://www.php.net/manual/en/function.array-uintersect-assoc.php)—计算具有附加索引检查的数组的交集,通过回调函数比较数据 * [array\_uintersect\_uassoc](https://www.php.net/manual/en/function.array-uintersect-uassoc.php)—使用附加的索引检查来计算数组的交集,并通过单独的回调函数比较数据和索引 * [array\_uintersect](https://www.php.net/manual/en/function.array-uintersect.php)—计算数组的交集,通过回调函数比较数据 * [array\_unique](https://www.php.net/manual/en/function.array-unique.php)—从数组中删除重复的值 * [array\_unshift](https://www.php.net/manual/en/function.array-unshift.php)—在数组的开头添加一个或多个元素 * [array\_values](https://www.php.net/manual/en/function.array-values.php)—返回数组的所有值 * [array\_walk\_recursive](https://www.php.net/manual/en/function.array-walk-recursive.php)—将用户函数递归应用于数组的每个成员 * [array\_walk](https://www.php.net/manual/en/function.array-walk.php)—将用户提供的函数应用于数组的每个成员 * [array](https://www.php.net/manual/en/function.array.php)—创建一个数组 * [arsort](https://www.php.net/manual/en/function.arsort.php)—以相反的顺序对数组进行排序并维护索引关联 * [asort](https://www.php.net/manual/en/function.asort.php)—对数组进行排序并维护索引关联 * [compact](https://www.php.net/manual/en/function.compact.php)—创建包含变量及其值的数组 * [count](https://www.php.net/manual/en/function.count.php)—计算数组或对象中的所有元素 * [current](https://www.php.net/manual/en/function.current.php)—返回数组中的当前元素 * [each](https://www.php.net/manual/en/function.each.php)—从数组返回当前键和值对,并前进数组光标 * [end](https://www.php.net/manual/en/function.end.php)—将数组的内部指针设置为其最后一个元素 * [extract](https://www.php.net/manual/en/function.extract.php)—从数组将变量导入当前符号表 * [in\_array](https://www.php.net/manual/en/function.in-array.php)—检查数组中是否存在值 * [key\_exists](https://www.php.net/manual/en/function.key-exists.php)— array\_key\_exists的别名 * [key](https://www.php.net/manual/en/function.key.php)—从数组中获取密钥 * [krsort](https://www.php.net/manual/en/function.krsort.php)—按键对数组进行反向排序 * [ksort](https://www.php.net/manual/en/function.ksort.php)—按键对数组排序 * [list](https://www.php.net/manual/en/function.list.php)—将变量分配为数组 * [natcasesort](https://www.php.net/manual/en/function.natcasesort.php)—使用不区分大小写的“自然顺序”算法对数组进行排序 * [natsort](https://www.php.net/manual/en/function.natsort.php)—使用“自然顺序”算法对数组进行排序 * [next](https://www.php.net/manual/en/function.next.php)—推进数组的内部指针 * [pos-](https://www.php.net/manual/en/function.pos.php)当前别名 * [prev](https://www.php.net/manual/en/function.prev.php)—倒带内部数组指针 * [range](https://www.php.net/manual/en/function.range.php)—创建一个包含一系列元素的数组 * [reset](https://www.php.net/manual/en/function.reset.php)—将数组的内部指针设置为其第一个元素 * [rsort](https://www.php.net/manual/en/function.rsort.php)—以相反的顺序对数组排序 * [shuffle](https://www.php.net/manual/en/function.shuffle.php)—随机打乱数组 * [sizeof](https://www.php.net/manual/en/function.sizeof.php)—计数别名 * [sort](https://www.php.net/manual/en/function.sort.php)—对数组[进行](https://www.php.net/manual/en/function.sort.php)排序 * [uasort](https://www.php.net/manual/en/function.uasort.php)—使用用户定义的比较功能对数组进行排序并维护索引关联 * [uksort](https://www.php.net/manual/en/function.uksort.php)—使用用户定义的比较功能按键对数组进行排序 * [usort](https://www.php.net/manual/en/function.usort.php)—使用用户定义的比较函数按值对数组进行排序 数组排序 | 函数名 | 排序依据 | 维持key关联 | 排序顺序 | 相关函数 | | --- | --- | --- | --- | --- | | [array\_multisort()](https://www.php.net/manual/en/function.array-multisort.php) | value | associative yes, numeric no | first array or sort options | [array\_walk()](https://www.php.net/manual/en/function.array-walk.php) | | [asort()](https://www.php.net/manual/en/function.asort.php) | value | yes | low to high | [arsort()](https://www.php.net/manual/en/function.arsort.php) | | [arsort()](https://www.php.net/manual/en/function.arsort.php) | value | yes | high to low | [asort()](https://www.php.net/manual/en/function.asort.php) | | [krsort()](https://www.php.net/manual/en/function.krsort.php) | key | yes | high to low | [ksort()](https://www.php.net/manual/en/function.ksort.php) | | [ksort()](https://www.php.net/manual/en/function.ksort.php) | key | yes | low to high | [asort()](https://www.php.net/manual/en/function.asort.php) | | [natcasesort()](https://www.php.net/manual/en/function.natcasesort.php) | value | yes | natural, case insensitive | [natsort()](https://www.php.net/manual/en/function.natsort.php) | | [natsort()](https://www.php.net/manual/en/function.natsort.php) | value | yes | natural | [natcasesort()](https://www.php.net/manual/en/function.natcasesort.php) | | [rsort()](https://www.php.net/manual/en/function.rsort.php) | value | no | high to low | [sort()](https://www.php.net/manual/en/function.sort.php) | | [shuffle()](https://www.php.net/manual/en/function.shuffle.php) | value | no | random | [array\_rand()](https://www.php.net/manual/en/function.array-rand.php) | | [sort()](https://www.php.net/manual/en/function.sort.php) | value | no | low to high | [rsort()](https://www.php.net/manual/en/function.rsort.php) | | [uasort()](https://www.php.net/manual/en/function.uasort.php) | value | yes | user defined | [uksort()](https://www.php.net/manual/en/function.uksort.php) | | [uksort()](https://www.php.net/manual/en/function.uksort.php) | key | yes | user defined | [uasort()](https://www.php.net/manual/en/function.uasort.php) | | [usort()](https://www.php.net/manual/en/function.usort.php) | value | no | user defined | [uasort()](https://www.php.net/manual/en/function.uasort.php) |