In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you the high-level features of PHP example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
The details are as follows:
Static attribute
Output: 0 hello
Comments: static properties and methods can be called directly through the class.
SELF
Output:
Hello (1) hello (2) hello (3)
Comments: self points to the current class, and this points to the current object. Self can call the static properties and methods of the current class. This points to the current object. Self can call the static properties and methods of the current class. This can call the normal properties and methods of the current class.
Constant attribute
Output: 0
Comments: constants can only be used in uppercase letters and can be called directly through the class.
Interface
If the getPrice method is not implemented, an error will be reported.
Fatal error: Class ShopProduct contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Chargeable::getPrice)
Inherit classes and interfaces
Abstract class
Let's take a look at a piece of code.
Output:
Document Object ()
Static method
Output:
User Object ([group:DomainObject:private] = > default) SpreadSheet Object ([group:DomainObject:private] = > document)
Final field
It doesn't use much to make a class impossible to inherit.
Output:
Fatal error: Class IllegalCheckout may not inherit from final class (Checkout)
The final method cannot be overridden
Output:
Fatal error: Cannot override final method Checkout::totalize ()
Destructor function
Output:
Do nothing
_ _ clone method
Execute when cloning
Output:
Person Object ([name:Person:private] = > bob [age:Person:private] = > 44 [id:Person:private] = > 343) Person Object ([name:Person:private] = > bob [age:Person:private] = > 44 [id:Person:private] = > 0)
Look at another example.
Comments: learning can still open up the brain, today finally understand why there are multiple arrows of the concept of $person- > account- > balance. The account property here is an object.
_ _ toString
The above is all the content of the article "sample Analysis of Advanced Features in PHP". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.