I have files with the following data:
SEQ: [+1]
DTM: [203:20050914:102]
FII: [OR+05407059214]
SEQ: [+2]
DTM: [203:20050915:102]
FII: [OR+05407059999]
SEQ: [+3]
DTM: [203:20050813:102]
FII: [OR+05407099999]
and so on....
The file could have 1 or 100 sections and I recieve them every day.
I want to put the information into a database. I'm thinking of the following solution where $contents is the data above:
$SEQ = explode('SEQ', $contents);
$count_SEQ = (count($SEQ) - 1);
$ii = 0;
$iii = 0;
for ($i = 0; $i < $count_SEQ; $i++)
{
$SEQ1 = explode("SEQ: [", $contents);
$SEQ2 = explode("]", $SEQ1[1]);
$DTM = explode("DTM: [", $SEQ[$iii]);
$DTM = explode("]", $DTM[1]);
$FII = explode("FII: [OR+", $SEQ[$iii]);
$FII = explode("]", $FII[1]);
$SEQ2_.$ii = $SEQ2[0];
$DTM_.$ii = $DTM[0];
$FII_.$ii = $FII[0];
$ii = $ii + 1;
$iii = ($iii + 2);
}
One problem with this is that it is not possible to use
$SEQ2_.$ii
I'm trying to have a variable where the name has a number that increase after every loop. Can anyone help me with a solution for this??
Is there an easyer way to do this? Does anyone know of a script that could do this for me?
Looking forward to your input!