Archive for January 25, 2008

$this variable & self class name

$this is a special variable of an object. Using $this, a member variable or methods of the class can be accessed from anywhere inside of that class.

self is a reserve class name which is also used inside the object itself.

For the static members and static methods and constants, self class name is used instead of $this. So when you use static method or variables and call it inside the same class you must use the self not the $this.

Leave a Comment