douwen1549 2014-08-27 19:12 采纳率: 100%
浏览 24
已采纳

基于类似的数组对数组进行排序?

I have 2 arrays with numerical indices that have the same number of keys and similar but not identical values. $unordered has the unordered data, whereas array $ordered has the data in the proper order. I want to sort $unordered in the same order as $ordered, but keep the percentage values in square brackets from $unordered.

$unordered:

[0] => "Horse [1%]"
[1] => "Cat [5%]"
[2] => "Dog [94%]"

$ordered:

[0] => "Cat"
[1] => "Horse"
[2] => "Dog"

Thanks.

  • 写回答

2条回答 默认 最新

      报告相同问题?

      悬赏问题

      • ¥15 ubuntu18.04 tty报错&tty界面su/sudo命令无法执行,如何解决?
      • ¥20 关于c语言网络编程,实现传文件和即时聊天
      • ¥20 下面的压缩方法是否可行
      • ¥15 结构体数组读取文件信息失败,读取不了
      • ¥15 kaldi thchs30 训练遇到问题
      • ¥15 shellter无法使用,如何解决?(操作系统-kali)
      • ¥15 matlab动态模态分解程序
      • ¥60 关于渗透及远控的几个问题
      • ¥15 python文本词汇出现次数统计
      • ¥15 使用按键和串口,记录按键在不消抖的情况下触发的次数