Question

Just wondering if require_once (or any of the include type functions) loads the entire external script when you call it, or just the functions from that script as you call them from the script you are using require_once in?

Was it helpful?

Solution

It loads the entire script. The only difference between require and require_once is that if you call require_once multiple times with the same script argument, the repetitions will be ignored.

A script loaded with require or include can have other things besides function definitions, and they need to be executed immediately when the file is loaded.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top