Seven syntax descriptions in the PHP class. Seven syntax descriptions in the seven syntax descriptions in the PHP class-attribute-static property-method-static method-class constant-constructor-destructor ;} seven syntax descriptions in the static method publicstaticfunc PHP class
Class seven syntax descriptions
-Attributes
-Static attributes
-Method
-Static method
-Class constants
-Constructor
-Destructor
';} // Static method public static function static_stuFunction () {echo 'static _ function ','';} // when the constructor creates an object, it automatically calls public function _ construct ($ stu_name) {$ this-> stu_name = $ stu_name; echo '_ construct ','';} // automatically call public function _ destruct () {echo '_ destruct', '';} when the destructor destroys an object ','';}} // instantiate class object $ object = new Student ('Tom '); // echo $ object-> stu_name ,''; // echo $ object: $ stu_num, ''; // class call static attribute echo Student: $ stu_num ,''; // call methods and static methods by using an object. $ object-> stuFunction (); $ object-> static_stuFunction (); $ object: stuFunction (); $ object :: static_stuFunction (); // use classes to call methods and static methods respectively Student: stuFunction (); Student: static_stuFunction (); // class call class constant echo Student: STUDENT, '';
Summary: objects can call attributes and static attributes. classes can only call static attributes. Objects can call methods and static methods. classes can call methods and static methods.
Seven syntax descriptions in the category class-attribute-static property-method-static method-class constant-constructor-destructor;} // static method public static func...