Re: [PHP] Re: include_once vs require_once
Perhaps the manual should be made to reflect this since, my understanding came from the online version of the manual. Sterling Philip Olson wrote: Yes, this is essentially true. Zeev posted this to the list awhile ago, see the following : http://www.faqts.com/knowledge_base/view.phtml/aid/6/ Essentially the difference now is the type of error that's produced, one being a warning (include) while the other being FATAL! (require). Regards, Philip On Tue, 31 Jul 2001, CC Zona wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Mike Cullerton) wrote: so the difference is _when_ they happen. ok, another question then. if my script includes the line require_once($file); and $file contains the line include_once($other_file); what happens then? Rasmus has stated before that there is no longer any difference between include_once() vs. require_once(), or include() vs. require(). I forget which version that became the case, but if you are using a current version of PHP the above two lines should produce identical results. -- CC -- 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] -- 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]
[PHP] Re: include_once vs require_once
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: include_once vs require_once
cool, so the difference is _when_ they happen. ok, another question then. if my script includes the line require_once($file); and $file contains the line include_once($other_file); what happens then? :) thanks, mike on 7/31/01 6:57 PM, Andrew Sterling Hanenkamp at [EMAIL PROTECTED] wrote: 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 -- mike cullerton -- 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]
Re: [PHP] Re: include_once vs require_once
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Mike Cullerton) wrote: so the difference is _when_ they happen. ok, another question then. if my script includes the line require_once($file); and $file contains the line include_once($other_file); what happens then? Rasmus has stated before that there is no longer any difference between include_once() vs. require_once(), or include() vs. require(). I forget which version that became the case, but if you are using a current version of PHP the above two lines should produce identical results. -- CC -- 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]
Re: [PHP] Re: include_once vs require_once
Yes, this is essentially true. Zeev posted this to the list awhile ago, see the following : http://www.faqts.com/knowledge_base/view.phtml/aid/6/ Essentially the difference now is the type of error that's produced, one being a warning (include) while the other being FATAL! (require). Regards, Philip On Tue, 31 Jul 2001, CC Zona wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Mike Cullerton) wrote: so the difference is _when_ they happen. ok, another question then. if my script includes the line require_once($file); and $file contains the line include_once($other_file); what happens then? Rasmus has stated before that there is no longer any difference between include_once() vs. require_once(), or include() vs. require(). I forget which version that became the case, but if you are using a current version of PHP the above two lines should produce identical results. -- CC -- 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] -- 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]