Re: how include works?
| From: | Stut | Date: | Tue, 30 May 2006 12:17:56 +0000 |
| Subject: | Re: how include works? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237076@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
On Tue, May 23, 2006 6:19 pm, Mindaugas L wrote:A better way to look at these functions is to think of them as running the included files. When they run they do so in the scope of the includer (i.e. will have access to any variables and functions the includer has) but it's not the same as if you had copied the code manually. Hope that made sense. -Stutcan anybody explain how require works, and what's the difference between _once and regular? What's going on when php file is processed? In manual is written just, that it's readed once if include_once. What does to mean "readed"? Thank Yourequire and include both basically work EXACTLY as if you copied/pasted the file into your source code, except that you are "out" of PHP mode in the included file. It's not *exactly* the same. Declarations in the included file (classes and function) are registered at the global level. This basically means that you cannot define the body of a class in an included file.