Home >Backend Development >PHP Problem >Is there any object in php
Is there an object in php?
There is an object in php. Its usage is: first, you can write an object through the class keyword class, or you can inherit a class through the extends keyword; then write methods and attributes in the class; and finally instantiate the object by using new followed by the class name.
Sample code:
class ClassName extends AnotherClass { //属性 public $name = 'xiaoming'; //构造方法 public function __construct() { } } //实例化类 $obj = new ClassName();
Recommended tutorial: "PHP Tutorial"
The above is the detailed content of Is there any object in php. For more information, please follow other related articles on the PHP Chinese website!