Opening large text files on Windows

From: Date: Fri, 24 May 2002 13:42:59 +0000
Subject: Opening large text files on Windows
Groups: php.general 
Request: Send a blank email to php-general+get-99084@lists.php.net to get a copy of this message
Good afternoon all. I have a problem with opening a text file in PHP. The file is test.txt a comma separated file with 62,000 lines (4Mb) of data. I have extended the execution time to 200 seconds to allow time to read the file. The code I am using is below. set_time_limit(200); $datafile = fopen ("text.txt", "r"); while (!feof ($datafile)) { $array = fgets($datafile, 1000000); if (trim($array)) { $count = count(explode($Seper, $array)); } // end if $array } // end while fclose ($datafile); echo $count; My problem is that the file never finishes. The php.exe (running on windows 2000) in the task manager keeps running for over 20 mins (then I kill it) and explorer keeps waiting for a reply. Is there a better way to read this file in to check ?? > Richard > This message is confidential to Sunrise Medical. If you are not the intended recipient, do not use or distribute this message; and please notify the sender by return of e-mail.

« previous php.general (#99084) next »