Home >Backend Development >PHP Tutorial >Features not found in a document in PHP [Reposted from Oso]_PHP Tutorial

Features not found in a document in PHP [Reposted from Oso]_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:12:39874browse

Object-oriented functionality in PHP supports the C++-style :: operator! ! !
//Lone Wolf: This:: appears frequently in PEAR. I was confused when I saw it for the first time :)
This feature document does not have any explanation, but it has very good use value.
Give a simple example:
For example, you have a lot of collected function libraries in the past, and you want to switch to OOP programming, but you cannot yet achieve complete encapsulation.
This feature provides you with an OOP style implementation.
You define a Util class:
class Util {
//Clip all functions here
//This class can not have any member functions
}
Then in your original Where a function is used, such as someFunction(), change it to:
Util::someFunction(). This is very useful when you need to encapsulate but do not need any member functions.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629334.htmlTechArticleThe object-oriented function in PHP supports the C++-style :: operator symbol! ! ! //Lone Wolf: This:: appears frequently in PEAR. I was confused when I saw it for the first time :) This featured document...
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