This question is about the PHP parsing engine.
When I include a file multiple times in a single runtime, does PHP tokenize it every time or does it keep a cache and just run the compiled code on subsequent inclusions?
EDIT: More details: I am not using an external caching mechanism and I am dealing with the same file being included multiple times during the same request.
EDIT 2: The file I’m trying to include contains procedural code. I want it to be executed every time I include() it, I am just curious if PHP internally keeps track of the tokenized version of the file for speed reasons.
By default the file is parsed every time it is (really) included, even within the same php instance.
But there are opcode caches like e.g. apc
(ok, weak proof. PHP could check whether the file’s mtime has changed. And that what apc does, I think. But without a cache PHP really doesn’t)