In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces what php static means. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
Static is a built-in keyword in php, and we can use the static keyword to define static methods and properties, as well as static variables and later static bindings.
This article operating environment: windows7 system, PHP7.4 version, DELL G3 computer
Static is a built-in keyword for PHP.
Static (static) keywords
Tips
This page explains using the static keyword to define static methods and properties. Static can also be used to define static variables and later static bindings. See the above page for the use of static in it.
If a class property or method is declared static, it can be accessed directly without instantiating the class. Can be accessed statically in an instantiated class object.
Static method
Because static methods do not need to be called through an object, the pseudo variable $this is not available in static methods.
Warning
Calling a non-static method statically throws an Error.
Prior to PHP 8.0.0, the use of calling a non-static method statically had been deprecated and resulted in an E_DEPRECATED-level warning.
Example # 1 example of static method
Static attribute
Static properties are accessed using the range resolution operator (::) and cannot be accessed through the object operator (- >).
It is possible to reference a class through a variable, but the value of this variable cannot be a reserved word (for example, self,parent and static)
Example # 2 example of static attributes
The output of the above routine in PHP 8 is similar to:
Foofoo
Notice: Accessing static property Foo::$my_static as non static in/ in/V0Rvv on line 23
Warning: Undefined property: Foo::$my_static in/ in/V0Rvv on line 23
Foofoofoofoo
The above is all the contents of this article "what does php static mean?" Thank you for reading! Hope to share the content to help you, more related 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.