Re: Mixing eval() with include/require
| From: | Cynic | Date: | Thu, 21 Dec 2000 18:09:56 +0000 |
| Subject: | Re: Mixing eval() with include/require | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31452@lists.php.net to get a copy of this message | ||
Hi Ignacio,
have you tried your function with require instead of include?
The effect is just the same.
The difference between include() and require() can be described
like so:
suppose somefile.php contains a few lines of text, no PHP code
(it'd be the same but is easier to grok this way)
suppose we have these two blocks in a php file:
if( false ) {
include( 'somefile.php' ) ;
}
if( false ) {
require( 'somefile.php' ) ;
}
the first block will never read somefile.php. the include()
call just won't execute.
the latter one WILL read somefile.php, but WON'T display its
contents.
BTW, Rasmus Lerdorf explained this pretty clearly here (or maybe at
php-windows, don't remember) about a week or two ago.
At 18:19 21.12. 2000, Ignacio Vazquez-Abrams wrote the following:
--------------------------------------------------------------
><?php
>function Test($id)
>{
> for ($i=0; $i<1000; ++$i)
> include("test$id.inc");
>};
>?>
>
>include()s can be dynamic that way; AFAIK require()s can't.
>
>--
>Ignacio Vazquez-Abrams <ignacio@openservices.net>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz