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.
More Related Contents:
- PHP mail() issue
- How to use this code my wordpress theme
- How to check if an email address exists without sending an email?
- What is stdClass in PHP?
- How to make PDF file downloadable in HTML link?
- Count number of values in array with a given value
- Get title of website via link
- Safely catch a ‘Allowed memory size exhausted’ error in PHP
- How do I install Composer PHP packages without Composer?
- Add ‘Watermark’ to images with php [closed]
- Remove .php extension (explicitly written) for friendly URL [closed]
- Traits in PHP – any real world examples/best practices? [closed]
- How to get system environment variables into PHP while running CLI & Apache2Handler?
- What does this mean? “Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”
- Add PHP variable inside echo statement as href link address?
- Convert exponential to a whole number in PHP [duplicate]
- Run a ffmpeg process in the background
- Enabling $_GET in codeigniter
- PDO: MySQL server has gone away
- How to check if a specific value exists at a specific key in any subarray of a multidimensional array?
- How do you do multiple SQL statements in one mysql_query?
- When to pass-by-reference in PHP
- Convert hex color to RGB values in PHP
- PHP Timezone List
- Which is faster? Constants, Variables or Variable Arrays
- Optional parameter in the middle of a route
- Access object property with disallowed character in property name
- Php & Sql Injection – UTF8 POC
- Sort a multidimensional array descending by subarray count and preserve first level keys
- How to display “12 minutes ago” etc in a PHP webpage? [closed]