> > PHP on the other hand seems to load in ALL the code that 
> MAY be run. 
> > i.e. an include brings things in which are inside an if,  
> even if the 
> > if equates to false.
> A quick check in the manual, it states that:
> "Unlike include(), require() will always read in the target 
> file, even if the line it's on never executes. If you want to 
> conditionally include a file, use include(). The conditional 
> statement won't affect the require(). However, if the line on 
> which the require() occurs is not executed, neither will any 
> of the code in the target file be executed. " 
> http://www.php.net/manual/en/function.require.php
> and
> http://www.php.net/manual/en/function.require-once.php
> So to do what you said i.e. conditionally load the 
> function/files that you want then you should use include(). 
> http://www.php.net/manual/en/function.include.php
> and
> http://www.php.net/manual/en/function.include-once.php
> So I don't buy this agument.

This is outdated. Look int othe archives - I had this discussion with
Zeev close to a year ago - since PHP 4.0.(something) require and include
behaves in the exactly same way.

Test it yourself on the latest release of PHP:


 echo 'included?';

        require 'require.error.test';



 echo '<H1>yup!</H1>';

 parse error;


Access it with:
 1. require.test.php?go=e

And then try it with:
 2. require.test.php

What do you buy now?

Maxim Maletsky

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to