selenin Posted May 26, 2010 Share Posted May 26, 2010 Hello I don't know for what's the variable $this, it has an other colour in my editor, is it for objects? Link to comment https://forums.phpfreaks.com/topic/202995-a-little-question/ Share on other sites More sharing options...
The Eagle Posted May 26, 2010 Share Posted May 26, 2010 A variable, yes is $foo = ''; $this may be a reserved variable. But I'm not certain. Surely enough, it's used for classes, virtually objects. $this = new Class(); Link to comment https://forums.phpfreaks.com/topic/202995-a-little-question/#findComment-1063735 Share on other sites More sharing options...
jordz Posted May 26, 2010 Share Posted May 26, 2010 $this is a pseudo variable used mainly in OOPHP I think. Link to comment https://forums.phpfreaks.com/topic/202995-a-little-question/#findComment-1063745 Share on other sites More sharing options...
jordz Posted May 26, 2010 Share Posted May 26, 2010 Taken from PHP.net, the best place to find answers. The pseudo-variable $this is available when a method is called from within an object context. $this is a reference to the calling object (usually the object to which the method belongs, but possibly another object, if the method is called statically from the context of a secondary object). Link to comment https://forums.phpfreaks.com/topic/202995-a-little-question/#findComment-1063746 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.