Re: fopen(); question

From: Date: Thu, 23 May 2002 22:38:14 +0000
Subject: Re: fopen(); question
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-84369@lists.php.net to get a copy of this message
On Thu, 2002-05-23 at 14:24, Jose Jeria wrote: > I am new to PHP and I have a simple question about fopen > > For example: > $tmp = fopen("testfile.txt", "r"); > > If the file is not found i get an error. ("No such file or directory") > So there is no point in checking for this like this: > > if($tmp) // statements > > Am I doing something wrong here? No. But if you want to suppress that error message, use a @ character in front of the fopen: if ($tmp = @fopen("testfile.txt", "r")) { } Please post questions like this to php-general@lists.php.net in the future. - Stig

« previous php.dev (#84369) next »