1024programmer PHP In PHP, if a class is not instantiated, will it occupy server resources? Solutions

In PHP, if a class is not instantiated, will it occupy server resources? Solutions

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.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/in-php-if-a-class-is-not-instantiated-will-it-occupy-server-resources-solutions/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索