In PHP, does the class use server resources if it does not instantiate? Solution Ideas
Source: Internet
Author: User
In PHP, does the class use server resources if it does not instantiate?
In PHP, does the class use server resources if it does not instantiate? Because I want to create a file, put all the classes in a file, when needed to include this file
------Solution--------------------
When the class file is loaded, PHP will compile the class
When a class is instantiated, PHP allocates memory to the corresponding object
When the object executes, PHP allocates memory for the property involved
------Solution--------------------
I don't think so, but the problem is relative, although you don't instantiate it, but it brings a new problem.
Include n classes of documents and include 1 classes of documents which do you think Occupy server resources? Of course, this occupancy can be ignored.
You can do this, but I'm not recommending that you do this from the maintenance and readability of the code will only bring you more trouble. The last reminder is whether you use __autoload if not then follow your thoughts.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.