note 126045 added to function.file
| From: | renanlazarotto at gmail dot com | Date: | Wed, 28 Apr 2021 18:37:06 +0000 |
| Subject: | note 126045 added to function.file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216332@lists.php.net to get a copy of this message | ||
Be aware that using file() to count lines can cause OOM on the server as it'll allocate all
lines into an array.
If you're dealing with files that can have thousands of lines, SplFileObject might be a better
idea and with little changes you can get the same result.
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 177.220.133.58)
----
Manual Page -- https://php.net/manual/en/function.file.php
Edit -- https://main.php.net/note/edit/126045
Del: integrated -- https://main.php.net/note/delete/126045/integrated
Del: useless -- https://main.php.net/note/delete/126045/useless
Del: bad code -- https://main.php.net/note/delete/126045/bad+code
Del: spam -- https://main.php.net/note/delete/126045/spam
Del: non-english -- https://main.php.net/note/delete/126045/non-english
Del: in docs -- https://main.php.net/note/delete/126045/in+docs
Del: other reasons-- https://main.php.net/note/delete/126045
Reject -- https://main.php.net/note/reject/126045
Search -- https://main.php.net/manage/user-notes.php