PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am not sure which is faster, although the speed difference is minimal. fopen/fread is binary safe, while file() is not. I tend to use file() for things like reading lines from text files, and fopen() for everything else
somehow the file must be read anyway and that's very similar to fread. Then the content is splitted into single lines (searching for linebreaks, creating a new string, add it to an array). Afterwards all elements are concatenated to one string (reallocate storage, append element content).
Yes, I would say fread() is faster