What is the difference between $this and self? When should we use each of them?
            Asked
            
        
        
            Active
            
        
            Viewed 1,240 times
        
    -4
            
            
         
    
    
        elixenide
        
- 44,308
- 16
- 74
- 100
 
    
    
        Shrikant D
        
- 807
- 1
- 8
- 14
2 Answers
4
            $this refers to the current instance. self refers to the current class. 
In other words, you can use $this->someMember to refer to an instance member and self::$someStaticMember to refer to a static member.
 
    
    
        Mureinik
        
- 297,002
- 52
- 306
- 350
