我有以下嵌套数组,我试图将每个嵌套的索引[1]从十六进制值转换为ascii。当我一次引用一个函数时,我已经有一个完美转换的函数但是当我尝试在for循环中遍历它时,我的输出日志文件中没有任何内容。
这是数组:
Array
(
[0] => Array
(
[0] => E2007C84D20119B16F6FD066
[1] => 37373535303931383400000000000000
[2] => 9/7/2016 10:42:51 PM
[3] => -57
[4] => 1
)
[1] => Array
(
[0] => E2007C84D200ABB16F6FCEAE
[1] => 37363835303032323000000000000000
[2] => 9/7/2016 10:42:51 PM
[3] => -62
[4] => 1
)
[2] => Array
(
[0] => E2007C84D20133316F6FD0CC
[1] => 37373335313834323400000000000000
[2] => 9/7/2016 10:42:52 PM
[3] => -52
[4] => 1
)
[3] => Array
(
[0] => E2007C84D2008B716F6FCE2D
[1] => 37363930303032383400000000000000
[2] => 9/7/2016 10:42:54 PM
[3] => -58
[4] => 2
)
[4] => Array
(
[0] => E2007C84D200D3316F6FCF4C
[1] => 37373335313534343300000000000000
[2] => 9/7/2016 10:42:54 PM
[3] => -52
[4] => 1
)
[5] => Array
(
[0] => E2007C84D2006C316F6FCDB0
[1] => 37373630303032303600000000000000
[2] => 9/7/2016 10:42:54 PM
[3] => -54
[4] => 1
)
[6] => Array
(
[0] => E2007C84D1544EF16F6E753B
[1] => 37373230393131333800000000000000
[2] => 9/7/2016 10:42:57 PM
[3] => -62
[4] => 2
)
)
这就是我一直在尝试的for循环:
for each ($dataArray[0] as $dataItem) {
$dataItem[1] = hex2str($dataItem[1]);
}
PHP数组总是给我带来麻烦。