I've been reading quite large text (.txt) files, but somehow I get a very weird result when reading a 3+ MB ttx file. It's essentially an XML text-based file. When using fopen or file() or fread or fgets I can display the contents on the screen using an echo / print.
However I can't run any preg_match or something similar on the $text from that file! If I look at the source in the browser of what gets printed out on the screen, PHP seems to add spaces when reading the file.
EXAMPLE:
- the text file contains
"text and more text"
*it get's printed out on screen correctly as
"text and more text"
- but the source looks like this:
"t e x t a n d m o r e t e x t"
As soon as the filesize is smaller (like a couple of 100k) it gets printed out correctly. What's going on and what's wrong? Why does PHP put in these spaces?
I've tested on a Windows and Linux machine.
Help appreciated.