After learning C and Java, I waited until I learned PHP. Today I finally understood what object-oriented is.
For example: a mobile phone is a class, the keyboard, battery, screen, etc. are member variables, and making phone calls, sending text messages, etc. are methods.
Object instantiation is like giving us all the functions of mobile phone A, converting the class into an object, and we (the object) can call any part of the mobile phone.
code:
class MyPc{
var $key;
public $name;
function vod(){
echo "php my favorite";
}
}
$pc1=new MyPc();//instantiation
$pc1->key="php";//Output php letters
echo $pc1->vod();//Output php my favorite
The above has introduced the suddenly looking back - object-oriented, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.