1.new static () is a new feature introduced in the PHP5.3 release.2. Either new static () or new self () is a new object.3. What is the difference between the new objects of the two methods, or is the new one the same class instance or a different
This article describes the difference between the new static () and the New self () in PHP, and I believe that it will help you to learn PHP programming.The problem was caused by building a station locally. Found in PHP 5.2 is not built up, the
Introduction to the difference between new static () and new self () in PHP, staticself
The Night is long!
Today the leader builds a local station. Found in PHP 5.2 built up, the station PHP code inside there are a lot of more than 5.3 parts, the
This article introduces the difference between New self () and new Static () in PHP, and shares it with everyone, as well as leaving a note for yourself.
1.new static () is a new feature introduced in the PHP5.3 release.
2. Either new static () or
What is new static () for?
PHP Code
Namespace mynamespace{ class MyClass {public function Show () { $a = new static (' A ', 1, ' B ', 32,$_get); Var_dump ($a); } } }
Output
Use self:: or __class__ a static reference to the current class, depending on the class in which the current method is defined: Using static:: Is no longer resolved to define the class in which the current method resides, but is evaluated at the
This article illustrates the difference between the new static () and the New self () in PHP, and believes that it will help you to learn the PHP program.
The cause of the problem is to build a local station. Found in PHP 5.2 can not build up, the
Differences between new static () and new self (), staticself
Long night!
Today, leaders build a local site. It was found that PHP 5.2 could not be built, and the website PHP Code contains more than 5.3 of the content. The leaders forced me to run
Use self:: or __class__ a static reference to the current class, depending on the class in which the current method is defined: Using static:: Is no longer resolved to define the class in which the current method resides, but is evaluated at the
New Static () is an additional feature introduced in the PHP5.3 version, whether it is new static () or new self (), which will be used to update the object. The following article mainly introduces you to the PHP object-oriented new self () and new
The difference between new static () and new self (), staticself
The Night is long!
Today the leader builds a local station. Found in PHP 5.2 built up, the station PHP code inside there are a lot of more than 5.3 parts, the leader let me change in
Comparison between new static () and new self () in PHP, staticself
Today in coding, I found new static (). Do I think the instantiation should be new self? After querying, you can see the differences between the two:
1) when sub-classes are
PHP new static and new self, staticself
Recently, I was asked a small question in a video comment: Is there any special consideration for static instead of self? Or we can convert the problem as follows:
What are PHP's new static and new self?
In
Long night!
Today, leaders build a local site. It was found that PHP 5.2 could not be built, and the website PHP Code contains more than 5.3 of the content. The leaders forced me to run the changes under 5.2.
Changed and found a place
return new
Difference between new self () and new static () in PHP object-oriented analysis, selfstatic
Preface
This article mainly introduces the differences between new self () and new static () in PHP object-oriented methods. What are the differences
Today, in coding, I found the new static (), and felt that the instantiation should not be new self ()? Query to know the difference between the two:
1 when there is a child-class integration, the performance of the two is not the same
2 PHP 5.2
The difference between new static () and new self () in PHP
Self: Always points to the class itself, regardless of how many times the class has been inherited, which points to the class that originally used self;Static: Pointing to a class that
PHP new Self () and new Static (), phpnewselfstatic
class A { publicstaticfunction get_self () { returnNew self (); } Public Static function get_static () { returnnewstatic(); class extends echoget_class// Aechoget_class // BEcho
The difference between new static () and new self () in PHP
Self: always points to the self code of the class itself, regardless of how many times the class has been inherited, self points to the class that originally used self;Static: Refers to a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.