2.11 a.m. is about object-oriented classes (class), a very abstract concept,
The definition of members within a class is public$abc; PRIVATE$ABC (private variable); protect $ABC (protected variable);
Here is an example to explain the class
<?PHPclasstest_123{ Public $a; Public $b; functionSquar () {return $this->a*$this->b;//here is the area of the rectangle, because the definition in class is abstract, so we need to instantiate the A.B } } $shili=NewTest_123 ();//instantiate the above class $shili->a=3; $shili->b=4;//Instantiate A, b$return=$shili-Squar ();Var_dump($return)?>
The output value is int (12);
Or it's easier to write in other ways.
<?PHPclasstest_123{functionTest_123 ($k,$v)//You can also use __construct to construct a frame by defining a B directly here. { $this->a=$k; $this->b=$v; } functionSquar () {return $this->a*$this->b;//here is the area of the rectangle, because the definition in class is abstract, so we need to instantiate the A.B } } $shili=Newtest_123 (3,4);//instantiate the above class Var_dump($shili-Squar ())?>
The above example can help us to better understand the concept of the class, relative to the theory is not so boring
Object-oriented classes (class) in PHP