In PHP, if a class is not instantiated, will it occupy server resources?
In PHP, if a class is not instantiated, will it occupy server resources? Because I want to create a file, put all the classes in one file, and include this file when needed
——Solution– ——————
When the class file is loaded, php will compile the class
When the class is instantiated, php will The corresponding object allocates memory
When the object is executed, php will allocate memory for the properties involved
——Solution——————–
Me Of course not, but this question is relative. Although you do not instantiate, it brings a new problem
Which one do you think is Include N class documents or Include 1 class document? Taking up server resources? Of course, this occupation may be ignored.
You can do this, but I don’t recommend it. It will only cause you more trouble in terms of maintenance and code readability. One final reminder is whether you use __autoload. If not then do what you want.