Next, I have a text file (.txt) with the following structure:
|100|Nome do Cliente|
|200|Produto 1|R$100|
|200|Produto 2|R$200|
|200|Produto 3|R$300|
In short, whenever the line starts with | 100 |, all | 200 | which follow below are related to | 100 | above. Using EXPLODE in PHP, I have the following Array:
Array(
[0] =>
[1] => 100
[2] => Nome do Cliente
)
...
That is, an array for each line. I would like to relate, in the array itself, the products to the client, in a structure where the products are in the same array as the Client, something like:
Array(
[0] =>
[1] => 100
[2] => Nome do Cliente
Array(
[0] =>
[1] => Produto 1
[2]=>R$100
)
Array(
[0] =>
[1] => Produto 2
[2] => R$200
)
... etc
)
Can anyone give me a light on how to relate this?