Best way to determine if a file is empty (php)?

file_get_contents() will read the whole file while filesize() uses stat() to determine the file size. Use filesize(), it should consume less disk I/O and much less memory.

Leave a Comment