Re: if test

From: Date: Tue, 19 Jun 2007 13:31:10 +0000
Subject: Re: if test
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-257404@lists.php.net to get a copy of this message
Jochem Maas wrote:
please keep posts on list. jekillen wrote:
On Jun 17, 2007, at 12:18 PM, Jochem Maas wrote:
jekillen wrote:
Hello again; does the following test pass if the file is successfully included: if( include( some file ) ) or does it pass with: if( ! include( some file ) )
have you tried it?
Well, typically while waiting for a reply, which I thank you for, I did browse through My Oreilly text Programming php which did not have anything definitive, and looking at the manual which did not have anything completely satisfying, I did try it as if( include( some file ) ) and it worked. But I also testing a file that I knew would cause an error, sure enough the else conditional did smear error messages all over the browser window.
I have no idea what else condition you mean and I also have no idea what these 'error messages' are or what they have to do with the original question (which I had assumed was about the testing return values from an include statement ... something you could have gleaned from the manual and a couple of tests.
So I did: if(file_exists( some file )) {
    include(some file);
} Thanks again JK
Im not exactly sure either about what you mean but you could give it a try using try {} catch {}

« previous php.general (#257404) next »