When I submit my php files to a server, are functions included in the global scope as soon as the file containing them is requested or this files are compiled as soon as I upload them? Do these functions remain in memory or they are parsed on every request?
Asked
Active
Viewed 47 times
2 Answers
0
They are parsed on every request.
PHP is not compiled in machine code but interpreted on runtime and executed.

GiamPy
- 3,543
- 3
- 30
- 51
0
This doesn't make sense. PHP is not some persistent process that you can introduce new files/functions to. When you upload a file to your server, that file doesn't do anything until you actually run it. If you're using a web server that supports PHP, you would probably run the PHP file by making an HTTP request.
PHP is a program that parses and evaluates the contents of a script. That script can include other scripts. In that specific instance of PHP, the functions are global (if they're declared as such) as soon as the function's declaration has been parsed and executed.

user229044
- 232,980
- 40
- 330
- 338