Home > Backend Development > PHP Tutorial > Detailed explanation of new self() in php_PHP tutorial

Detailed explanation of new self() in php_PHP tutorial

WBOY
Release: 2016-07-13 09:49:36
Original
1920 people have browsed it

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

www.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. ...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template