note 55032 added to function.fseek

From: Date: Fri, 22 Jul 2005 20:41:13 +0000
Subject: note 55032 added to function.fseek
Groups: php.notes 
Request: Send a blank email to php-notes+get-92319@lists.php.net to get a copy of this message
Actually chenganeyou, your function causes the entire file to be read into an array, and then you look at the last element of the array. While this works fine for a small file, an sizeable file is going to suck down memory and time. Using a 15 MB file your function took around 2 secs to return. The function provided by Jim goes directly to the end of the file and only reads in that line. I had to set the offset ($pos) to -2 for it to work in my case however. Using the same 15 MB file this function returns immediately. ---- Manual Page -- http://www.php.net/manual/en/function.fseek.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55032 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55032&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55032&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55032&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55032&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55032&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55032&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55032&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#92319) next »