The static keyword is static,static is a modifier that modifies the class's behavior and the class's object, and can be called directly by the class name, in addition to being called by the object.
* * Constants
$this can only access variables and functions in a class
Constants in classes that are accessed within a class can only use the Self keyword
If you need to directly access a constant in a class outside of the class, use the class name +::, or you can use the instantiated object of the class to access the constants in the class
* * Static variables
* Static variables are variables that exist only at the function scope
static variables are more special, It is placed in the static area of the computer's memory
example: starting from PHP5.3.0 to use the following access method
echo $ Test:: $num;
$test:: $num = $;
echo ' changed static variable: '. $test:: $num;
** static method
non-static functions can call static function methods directly
external access to static methods: Use class name + range resolution operator + static function method name
example: MyObject:: DESC2 ();
$a->desc2 (); Such a way to access static resources, not recommended
For example:
Static and declared constants in the class of PHP