0
How can I read a TXT file in this format to insert into an episode table? This is the structure:
temporada{
numero_episodio - nome_do_episodio
}
A practical example:
1{
1 - Episódio número 1 na 1ª Temporada
2 - Episódio número 2 na 1ª Temporada
...
}
2{
1 - Episódio número 1 na 2ª Temporada
2 - Episódio número 2 na 2ª Temporada
...
}
How to traverse, read and separate these lines so that an array is in the following format: episodios[temporada][episodio][nome_do_episodio]
, is it possible? Is there any easier way to organize this TXT?
I don’t have much experience with preg_split and preg_match functions, can give me a practical example of how to apply them to my example?
– Leo Letto
I had a doubt Leo, this format you invented? Have you heard of JSON? I don’t really know if it pays to create a parse of your own when you can use a more used format ;)
– Guilherme Nascimento
Sometimes it will be necessary to add a large amount of episodes at once, this was the easiest format I found for other users to add more lines at a time, I will even create a form for such, but I want to make this option available as well, but I will check the possibility to use json
– Leo Letto
Leaving such an operation for the user to modify manually is a huge risk. As simple and intuitive as it makes the format the user will manage to spoil most of the time.
– Guilherme Nascimento
It’s just someone other than me, it would be useful because many times we need to leave the episodes ready to be inserted, but we don’t want them in the database yet, so it would be useful to have them separated into a Txt, but I will leave only a form with dynamic fields.
– Leo Letto
Have you ever thought to insert them into the system and simply leave as active or inactive?
– Jeferson Almeida
I’ll think it over, and I’ll see with the other person if he really wants a way so much simpler that he can’t use a form for such
– Leo Letto