Home  >  Article  >  Backend Development  >  How to write a PHP class? _PHP Tutorial

How to write a PHP class? _PHP Tutorial

WBOY
WBOYOriginal
2016-07-14 10:09:331006browse


Well, this is a question that sounds easy but is not easy in practice. A few days ago, I was chatting with the technical director of a company about the application of PHP object-oriented in the company. What he meant was: very few PHPers understand object-oriented nowadays. The reason is simple, there is no compelling reason why you must use objectified PHP. Not only that, you have to understand one thing. The threshold for object-oriented is not low, but the threshold for PHP is very low.
I admit that he is right. Judging from my experience in the past few years, many people only understand the basic syntax of PHP class, but some core ideas, such as: class creation principles, design patterns, etc., these The application of theoretical knowledge cannot be truly understood without a certain period of experience. Our troubles mainly lie in the following areas:
1. Why use
2. The threshold is very high, how to persist
3. Usage scenarios
4. What are the benefits? Why do I have to use object methods when I can use process methods?
Unfortunately, every object-oriented book has the answer. But, can we really understand?
It just so happens that we are making course-based products, so I also plan to give a course that mainly explains how to use object-oriented in the PHP environment through practice. I expected this course to be very easy to learn, so I also made it very simple:
1. Introduce the usage environment
2. Explain a small knowledge point through examples each time
3. Publish all source codes to github for sharing
4. The class library can be used directly and updated regularly
This is an idea, and of course it needs to be implemented.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477627.htmlTechArticleWell, this is a question that sounds easy, but is not easy in practice. A few days ago, I was talking to the technical director of a company about the application of PHP object-oriented in the company. What he meant...
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