In PHP :: gt; self $this operators

  • 2020-05-30 19:46:20
  • OfStack

When accessing a member variable or method in the PHP class, the operator must be used if the referenced variable or method is declared as const (defining constants) or static (declaring static), whereas if the referenced variable or method is not declared as const or static, the operator - must be used > .

In addition, if you access the const or static variables or methods from within the class, you must use the self-referenced self, whereas if you do not access the const or static variables or methods from within the class, you must use the self-referenced $this.

Related articles: