When would you use the $this keyword in PHP?

前端 未结 12 1737
长发绾君心
长发绾君心 2020-12-15 11:03

When would you use the $this keyword in PHP? From what I understand $this refers to the object created without knowing the objects name.

Al

12条回答
  •  死守一世寂寞
    2020-12-15 11:26

    no i think ur idea is wrong.. $this is used when refers to a object of the same class.. like this

    think we have a variable value $var and in THAT instance of that object should be set to 5

    $this->var=5;

提交回复
热议问题