php-general | 2001072
Date: 07/31/01
- Next message: dave: "[PHP] Install problem"
- Previous message: mike cullerton: "[PHP] include_once vs require_once"
- In reply to: mike cullerton: "[PHP] include_once vs require_once"
- Next in thread: mike cullerton: "Re: [PHP] Re: include_once vs require_once"
- Reply: mike cullerton: "Re: [PHP] Re: include_once vs require_once"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Did you look at the difference between include() and require()?
Basically, as I understand it, require() and require_once() are replaced
during parsing--before code execution. And include() and include_once()
are replaced during code execution. Thus, a required file is always
imported into the file whereas an included file is only imported if the
include() statement is executed. The same is true for the _once()
versions except that the statement evaluates to nothing if the file has
already been imported by another statement.
Cheers,
Sterling
Mike Cullerton wrote:
> hey folks,
>
> i'm wondering about the difference between include_once and require_once.
> the manual says
>
> The require_once() statement replaces itself with the specified file
>
> The include_once() statement includes and evaluates the specified file
>
> so, what is the difference? it's almost like one is a copy/paste and the
> other is some kind of read. is there any different behavior we should expect
> in scripts using one method vs another.
>
> my first guess was that require_once wouldn't evaluate the file, but i can
> execute code from within a file using either method.
>
> thanks,
> mike
>
>
> -- mike cullerton
>
>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: dave: "[PHP] Install problem"
- Previous message: mike cullerton: "[PHP] include_once vs require_once"
- In reply to: mike cullerton: "[PHP] include_once vs require_once"
- Next in thread: mike cullerton: "Re: [PHP] Re: include_once vs require_once"
- Reply: mike cullerton: "Re: [PHP] Re: include_once vs require_once"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

