0
In php, why use file to read
In php, the most common ways to read a file are fread(), fgets(), and fgetc(), why did you choose to only mention file()?
4 Answers
+ 1
Actually, I read that before I made my post. I have actually only used fread, fgets, and fgetc and i have been a php programmer since 2003. I am just thinking your students should be taught the most commonly used aspects of the language first.
+ 1
There even more ways to read like file_get_contents.
file is very good to iterate different rows as it stores the file in an array.
0
//There are some differences between between them, I want you to read this in W3schools
https://www.w3schools.com/php/php_file_open.asp
0
Daniel, fgets will get things line by line as well. But if file_get_contents reads it directly into an array, i should have used it before. lol.