Home >Backend Development >PHP Problem >Is it necessary to learn object-oriented php?

Is it necessary to learn object-oriented php?

藏色散人
藏色散人Original
2019-10-16 09:21:522456browse

Is it necessary to learn object-oriented php?

Is it necessary to learn object-oriented php?

php It is necessary to learn object-oriented, because object-oriented is the core content of PHP knowledge.

PHP Object-oriented

1. Introduction to object-oriented

Object-oriented is a programming idea. Programming ideas are process-oriented and object-oriented

Process-oriented: Programming ideas focus on the process

Object-oriented: Programming ideas focus on the participating objects

2 .Benefits of object-oriented

1. Convenient collaboration among multiple people

2. Reduce code redundancy and high flexibility

3. Code reusability Take it to the extreme

4. Strong scalability

The main three characteristics of the object:

The behavior of the object: What operations can be applied to the object , turning on the lights and turning off the lights are behaviors.

The shape of the object: how the object responds, color, size, and appearance when those methods are applied.

Representation of objects: The representation of objects is equivalent to an ID card. It specifically distinguishes the differences between the same behaviors and states.

For example, Animal is an abstract class. We can specify a dog and a sheep, and dogs and sheep are concrete objects. They have color attributes, can be written, can run and other behavioral states.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of Is it necessary to learn object-oriented php?. For more information, please follow other related articles on the PHP Chinese website!

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