Well, yesterday I had asked for help on the subject here that friends soon helped me, but I came up against another problem:
Then I realized that the .TXT file has several levels, not just 2 as I had observed yesterday. I tried every way to solve the problem, but it's complicated for me. Next:
|0000|nome da empresa|cnpj|
|0100|nome do cliente|cod|
|0150|produto 1|preço|
|0150|produto 2|preço|
|0150|produto 3|preço|
|0100|nome do cliente|cod|
|0150|produto 1|preço|
|0150|produto 2|preço|
|0150|produto 3|preço|
In this case, the expected result is the array below:
Array(
[0] => 0000,
[1] => nome da empresa,
[2] => cnpj,
[3] => array(
[0] => 0100,
[2] => nome do cliente,
[3] => cod,
[4] => array(
[0] => 0150,
[1] => produto 1,
[2] => preço,
)
[5] => array(
[0] => 0150,
[1] => produto 2,
[2] => preço,
)
...
)
...
)
I'm sorry to be repeating the question, I have not been able to edit my previous question in addition to finding that the other one also has a very useful answer to the format presented there. I hope there is a possibility of maintaining this structure in a loop where there are several customers and products within the same company. Thank you in advance!