Just curious and I haven't really seen anything about this anywhere.
Is there an explanation of the stages PHP goes through in compiling -vs-
parsing a PHP script? google resulted in lots of pages about how to
compile PHP itself, but couldn't find anything about the stages of
php "compilation"
If I do a require_once("somefile.php"); does somefile.php get loaded and
parsed once for each web request? (Guess I'm wondering what PHP's
equivelant of perl's 'use' is)
Is there some way one could do this (psuedo code):
// This would run ONLY once during (or just after) the file is parsed.
// it would not run on each web request, but it's variables are usable
// across multiple requests. perhaps things like $_SERVER and
// $_POST/$_GET wouldn't be available (or usable)
//
compile_time: {
$conf = parse_ini_file();
$doc = parse_xml_document();
$obj = new Expensive_Object();
// Other "expensive" things.
require_once,_no_really_this_time("some_library.ph p");
}
Now share $conf, $doc, $obj and other variables with each web request.
The big question is the require_once() stuff.
Jamie