【发布时间】:2019-05-13 16:03:59
【问题描述】:
好的...所以,我有一个系统,可以为我提供一系列项目。这些项目如下所示:
Array
(
[1] => Array
(
[protocol] => ip
[dst-address] => 10.0.0.1
[tx] => 0
[rx] => 0
[tx-packets] => 0
[rx-packets] => 0
)
[2] => Array
(
[protocol] => ip
[dst-address] => 10.0.0.112
[tx] => 0
[rx] => 0
[tx-packets] => 0
[rx-packets] => 0
)
[3] => Array
(
[protocol] => ip
[dst-address] => 10.0.0.130
[tx] => 0
[rx] => 0
[tx-packets] => 0
[rx-packets] => 0
)
[4] => Array
(
[tx] => 0
[rx] => 0
[tx-packets] => 0
[rx-packets] => 0
)
[5] => Array
(
[protocol] => ip
[dst-address] => 10.0.0.5
[tx] => 0
[rx] => 496
[tx-packets] => 0
[rx-packets] => 1
)
[6] => Array
(
[protocol] => ip
[dst-address] => 10.0.0.6
[tx] => 0
[rx] => 528
[tx-packets] => 0
[rx-packets] => 1
)
[7] => Array
(
[protocol] => ip
[dst-address] => 10.0.0.16
[tx] => 624
[rx] => 0
[tx-packets] => 1
[rx-packets] => 0
)
[8] => Array
(
[protocol] => ip
[dst-address] => 10.0.0.24
[tx] => 0
[rx] => 448
[tx-packets] => 0
[rx-packets] => 1
)
[9] => Array
(
[protocol] => ip
[dst-address] => 10.0.0.31
[tx] => 0
[rx] => 528
[tx-packets] => 0
[rx-packets] => 1
)
[10] => Array
(
[protocol] => ip
[dst-address] => 10.0.0.44
[tx] => 10592
[rx] => 13200
[tx-packets] => 20
[rx-packets] => 28
)
你看到了吗,条目 ID 4 错过了表格上的一些列。
在 PHP 中,如何从数组中删除错误的行? 我想正确修复数组,以便重新排序以显示如下内容: - 顶级交易 - 顶级处方 - 顶级 tx 数据包 - 顶级 rx 数据包 - 拥有最多 tx 或 rx 或 tx-packets 或 rx-packets 的 dst-address 是什么。
关于信息,这个数组是动态的。我的 PHP 代码将在 while(true) 循环(无数据存储)上从设备(路由器)获取它。
【问题讨论】:
-
您应该尝试自己编写代码。在doing more research 之后,如果您有问题发布您尝试过的方法,并清楚地解释什么不起作用,并提供a Minimal, Complete, and Verifiable example。阅读How to Ask 一个好问题。请务必take the tour 并阅读this。