多排序数组...... [英] Multi-sorting arrays ...

查看:87
本文介绍了多排序数组......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图让一个数组对特定列进行排序,并且

一直存在我的主键问题...


array_multisort ($ dirlist [" dirname"],SORT_DESC,SORT_STRING);


此函数接受一个数组($ dirlist)已加载

目录列表,其中每个目录都有自己的索引号

(" dirid")并按名称降序显示列表

(" dirname")。这适用于名称的排序,但索引

数字被重新分配(我假设因为它是数字)而且我丢失了目录的

链接。 arrgghh!


如何保持行''在一起''并确保索引号

和名称保持一致?


任何提示或语法片段都会有很大的帮助。


问候,

Alan Searle。

解决方案

dirlist [" dirname"],SORT_DESC,SORT_STRING);


此函数采用数组(

dirlist)已经加载了一个

目录列表,其中每个目录都有自己的索引号

(dirid)并显示按名称降序列出

(" dirname")。这适用于名称的排序,但索引

数字被重新分配(我假设因为它是数字)而且我丢失了目录的

链接。 arrgghh!


如何保持行''在一起''并确保索引号

和名称保持一致?


任何提示或语法片段都会有很大的帮助。


问候,

Alan Searle。


Alan Searle写道:

我一直试图让一个数组对特定列进行排序,并且我的主键出现了问题。 ..

array_multisort(


I have been trying to get an array to sort on a particular column and
have been having problems with my main key ...

array_multisort($dirlist["dirname"], SORT_DESC, SORT_STRING);

This function takes an array ($dirlist) which has been loaded with a
directory listing where each directory has its own index number
("dirid") and displays the listing in descending order by name
("dirname"). This works fine for the sorting of the names but the index
number is reallocated (I assume because it is numeric) and I lose my
link to the directory. arrgghh!

How can I keep the rows ''together'' and make sure that the index number
and the name remain consistant?

Any tips or snippets of syntax would be a great help.

Regards,
Alan Searle.

解决方案

dirlist["dirname"], SORT_DESC, SORT_STRING);

This function takes an array (


dirlist) which has been loaded with a
directory listing where each directory has its own index number
("dirid") and displays the listing in descending order by name
("dirname"). This works fine for the sorting of the names but the index
number is reallocated (I assume because it is numeric) and I lose my
link to the directory. arrgghh!

How can I keep the rows ''together'' and make sure that the index number
and the name remain consistant?

Any tips or snippets of syntax would be a great help.

Regards,
Alan Searle.


Alan Searle wrote:

I have been trying to get an array to sort on a particular column and
have been having problems with my main key ...

array_multisort(


这篇关于多排序数组......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆