I am new to XML but am trying to use dhtmlxGrid for one of my sites. I am reading a text file and putting the data into an array. It seems that most of the examples I see use associative arrays to convert to XML.
I have:
Array (
[0] => Array ( [0] => 1 [1] => 243.4002 [2] => 0.9099 )
[1] => Array ( [0] => 2 [1] => 222.1930 [2] => 0.9092 )
)
But probably need:
Array (
[0] => Array ( [rownum] => 1 [reading1] => 243.4002 [reading2] => 0.9099 )
[1] => Array ( [rownum] => 2 [reading1] => 222.1930 [reading2] => 0.9092 )
)
This is how I am creating my array:
$filename = $_FILES["file"]["tmp_name"];
$file_handle = fopen($_FILES["file"]["tmp_name"], "r");
while (!feof($file_handle)) {
$line = fgets($file_handle);
$counter = $counter+1;
if ($counter >= 9) {
$splitLine[] = explode("\t", $line);
}
I am struggling figuring out how to create an associative array here. TIA.