Detailed explanation of new self() in php
php new self() This usage is rare, and it is basically impossible to find detailed information about this usage. This article will simply make some notes now and will update it slowly in the future.
php new self() is generally used inside a class. Its function is to instantiate its own class. Here is an example to explain how to use it:
<?php
class phpernote{
public function __construct(){
echo 'php程序员的笔记!';
}
public static function getInstance(){
new self();
}
}
phpernote::getInstance();
Copy after login
Return results:
Notes from PHP programmers!
Articles you may be interested in
- Usage of several keywords such as $this, static, final, const, self and so on in php
- How to delete PHP array Elements in (unset, array_splice)?
- Detailed explanation of the difference between empty, is_null and isset in php
- php finds whether a certain value exists in the array (in_array(), array_search(), array_key_exists())
- Full summary of String Functions in PHP
- How PHP determines whether the current operating system is linux or windows
- Think about the difference between execute and query methods in PHP
- The usage and difference of using break, continue, goto, return and exit to break out of multiple loops in PHP
http://www.bkjia.com/PHPjc/1019140.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1019140.htmlTechArticleDetailed explanation of new self() in php php new self() This usage is rare and cannot be found in searches Details about this usage. This article will simply make some notes now and will update it slowly in the future. ...