michael_morris1 — 2011-09-19T08:37:34-04:00 — #1
I'm skipping weekends with this btw...
file_get_contents is the cleanest way to fetch a file in php. The offset and maxlength parameters will normally not see use unless the file is large enough to exhaust PHP's memory allowance.
$file = file_get_contents($path);
starlion — 2011-09-19T09:13:09-04:00 — #2
Only thing I have to say here is to note the return type on this function - is String, not a file pointer, and altering the output does not change the file (though you could use file_put_contents to do so; it's slightly wasteful, as it will open/close the file twice.)
michael_morris1 — 2011-09-19T13:31:24-04:00 — #3
Good to note that. Yeah, this function and it's cousin are for "quick and dirty" file manipulations. More intensive operations are better handled with the older commands or a file iterator.