1
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| 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 customer, in a structure where the products are in the same array as the Customer, 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 someone give me a light on how to relate this?
All customers start with 100 and all products with 200?
– Guilherme Nascimento