In object-oriented programming (English: Object-oriented programming, abbreviation: OOP), an object is a whole composed of information and a description of how to process the information. An abstraction of the real world.
The main three characteristics of the object:
The behavior of the object: what operations can be applied to the object, turning on the light and turning off the light 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.
PHP language can apply both process-oriented and object-oriented programming. In many programming languages, process-oriented and object-oriented can only be programmed with one of the two. However, PHP language is different from other programming languages. The difference is that we can freely choose or mix PHP process-oriented and PHP object-oriented.
Process-oriented programming adopts the strategy of exchanging time for space. Because in the early days, the computer configuration was low and the memory was small. How to save memory became the top priority, even if the running time was longer. With the development of hardware technology, hardware no longer becomes a bottleneck. On the contrary, issues such as better simulation of the real world and system maintainability have emerged, so object-oriented design emerged as the times require.
Currently, general application systems applied on PCs generally use object-oriented methods because they do not need to consider hardware limitations, but the system maintainability and other aspects are very demanding; while when there are memory limitations, The required embedded systems are mostly designed and programmed in a process-oriented manner.
Procedure oriented programming: Procedure oriented programming, referred to as POP, is a process-centered programming idea, which is to analyze the steps required to solve the problem, and then use variables and functions to implement these steps step by step. When using, just call them one by one.
The above is the detailed content of Is php object-oriented?. For more information, please follow other related articles on the PHP Chinese website!