Home >Backend Development >PHP Tutorial >What does :: mean in php? About the description and application of :: in php

What does :: mean in php? About the description and application of :: in php

WBOY
WBOYOriginal
2016-07-29 09:15:131332browse
1. Reference methods of static methods and static properties in classes
For example,
class Test{
public static $test = 1;
public static function test(){
}
}
can be used without instances Transform the object and directly use Test::$test to get the value of the $test attribute

The same applies to calling the static method Test::test(); directly call the static method test

2.Two colons (::) are static references to methods in the class
That is, there is no need to instantiate the object, and the methods in the class are directly referenced through the class name

The above introduces what does :: mean in php? Regarding the description and application of :: in php, it includes some aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php object-orientedNext article:php object-oriented