Re: feof Question

From: Date: Sun, 09 May 2004 16:53:09 +0000
Subject: Re: feof Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185754@lists.php.net to get a copy of this message
* Thus wrote Harish (harish@cbayscribe.com): > > Hi > > I am using Linux, Apache, MySql, PHP. In the below mentioned code example when the counter data > that is displayed on the screen going to a indefinite loop. The file that is read has got sufficient > permissions. > > What are the reasons and how do I tackle the problem? > > <?php > $fp = fopen( 't.txt', 'r' ); if ($fp === false) { die('cant open file'); } always check the result of an fopen. feof() will only work on a valid file handle. $fp = false; while (!feof($fp) ) { //infinite loop } and you'll never know what hit you if your error_reporting is to low; ensure that at minimum, E_WARNING is on. Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#185754) next »