Re: file_exists
| From: | Miguel Cruz | Date: | Tue, 07 May 2002 04:24:43 +0000 |
| Subject: | Re: file_exists | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96351@lists.php.net to get a copy of this message | ||
On Mon, 6 May 2002, Craig Westerman wrote:
> What am I doing wrong? I get parse error between first echo statement and
> else.
>
> <?php
> $fn = "image.gif";
> if (!file_exists($fn)) {
> echo "<img src=noimageexists.gif>";
> else
> echo "<img src=$fn>";
> }
> ?>
You open the brace for the positive branch of the if and then leave it
open surrounding the else condition.
WRONG:
if (condition)
{ do something;
else
do something else;
}
RIGHT:
if (condition)
{ do something; }
else { do something else; }
As for "finding the problem" with file_exists' limitation to local files,
that's a different problem.
miguel