多排序数组......

编程入门 行业动态 更新时间:2024-10-08 22:49:28
本文介绍了多排序数组......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直试图让一个数组对特定列进行排序,并且 一直存在我的主键问题... 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(

更多推荐

多排序数组......

本文发布于:2023-11-29 06:13:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1645572.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!