I have a text file containing something like this:
1|text1|
2|text2|
3|text3|
4|text4|
5|text5|
A php script is reading that text file like so:
$lines = file('file.txt');
for ($i = 0; $i < count($lines); $i++)
{
$words = explode('|', $lines[$i]);
}
The problem is, it is not exploding it.
I think it is caused by: '|'. Because when I reformat the text file using microsoft excel to a csv file and then explode using: ';' then it is working fine.
But I do not want to manually format the file first using excel, how can I get it working so it explodes the '|'?
Thanks in advance