【发布时间】:2017-10-18 13:30:53
【问题描述】:
有格式的文本文件:
(400, 530); 6.9; 5.7; 5.0;//------> continues for 100 values.
(500, 530); 7.9; 5.1; 5.0;
(600, 530); 6.7; 6.7; 7.2;
代码:
<?php
$file="./Speed10.asc";
$document=file_get_contents($file);
$rows = explode ('(', $document); //splits document into rows
foreach ($rows as &$rowvalue) {
explode (';', $rowvalue);<----- How to assign each of these to member
of an array??
}
}
?>
我正在尝试创建二维数组,首先拆分为行,然后按元素拆分为 ';'
【问题讨论】:
-
你期望的输出是什么???
-
这是
$result[] = explode (';', $rowvalue);ok -
预期输出为 [1][0]: (400, 530); [1][1]:6.9; [1][2]:5.7; [1][3]:5.0;等
-
@KrisRoofe 谢谢你的回答,我说这会创建多个版本的 $result[] 是否正确?避免这种情况是我想不通的。
标签: php html arrays multidimensional-array data-extraction