How to define classes in php object-oriented
This article mainly introduces the relevant knowledge of "how to define classes in php object-oriented". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to define classes in php object-oriented" can help you solve the problem.
1. Use the keyword class to define a Human class. Human is the name of a class, which can be set by yourself just like the function name. Human means person. Here, a person's category is defined.
2. Instantiate the class
$Xiaoming=new Human ()
At this point, you just instantiate the class, and $Xiaoming is the object of the Human class.
We can set a value for this object. Some methods need to be added to set the value:
This is the end of the introduction to "how to define classes in php object-oriented". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.