Passing variables with REQUIRE function (part II)
In http://www.faqts.com/knowledge-base/view.phtml/aid/1205/fid/40 it is stated that require 'copies'
Jan 24th, 2009 09:06
Brad Kint, healthy man, dman, ha mo, Praveen Kumar Kukkapalli, Cinley Rodick, Matt Gregory, Bjarke Bisgaard Blendstrup, http://www.ttnr.org
Since there is no question here, I'm going to assume that you are
asking what coppies means.
If this is indeed your question, then the answer would be that the php
script loaded by the require function effectively is parsed in-line
where the require function is called.
For instance: let's pretend you have 5 lines of code over 2 files:
$yadda="y pues nada";
functions would be parsed in the following order:
1.) globals.phtml is parsed and loaded with mytest.phtml, parse errors
will be found before any script execution even if they are in
2.) new variable $hoopy is allocated and assigned the value of
3.) $hoopy is re-assigned the value of "dude".
4.) $yadda is allocated and assigned the value of "bite me".
5.) $yadda is reassigned the value of "y pues nada";
So, as you see, the script engine runs on 1 file, the conbination of
the previous two, while the parser sees two files. Therefore any
scripting is executed in-line (unless of course you happen to have
functions, in which case: make sure they aren't within other functions
or else you will have a parse error.
Rule of thumb: put everything inside of a script which will be included
in require statements inside of functions.