top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What is the difference between $this and self in PHP?

0 votes
43 views
What is the difference between $this and self in PHP?
posted Mar 6 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

i think one of the deference of $this and $self is mention below:

PHP supports classes and other object-oriented constructs. Static functions and variables in PHP classes are not associated with any specific instance of the class (in other words, an object).
Instead, static functions and variables are associated with the class definition itself. In other words, all instances of a class share the same static variable. Within the context of a method (function) of a class, static variables and functions are accessed using self::. Other methods and variables are used in the context of an object (an instance) of a class, using this.

answer May 7 by Siddhi Patel
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...