When would you use the $this keyword in PHP?

前端 未结 12 1732
长发绾君心
长发绾君心 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:23

    Whenever you want to use a variable that is outside of the function but inside the same class, you use $this. It is a core php concept.

提交回复
热议问题