Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the method modifier static of the php class

Shulou Source: shulou.com Published: 2022-06-01 13:10:49 09月10日 Update

This article will explain in detail how to use the method modifier static of the php class. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

The method modifier static of the php class

The method modifier of the php class is static final abstract

Static [static]

1. The attributes modified by static are called static attributes, and the methods modified by static are called static methods.

two。 The space allocated when the static property loads the class and is destroyed after the program has been executed. Memory is allocated only when other normal properties new.

3. Static members have only one copy in memory

4. Static static member call method class name:: property name class name:: method name ()

5. If there are multiple modifiers, there is no order between the modifiers.

Note that self represents the class name of the current class

Static members can also be inherited

Class Person {public static $add = 'Beijing'; public static function show () {echo 'this is a static method';}} echo Person::$add; Person::show () This is the end of this article on "how to use the method modifier static of php class". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Method static property member article class name memory more allocation good practical ordinary between successively content multiple article time knowledge program Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information macOS Xiaomi Linux vpn