web_master Posted October 25, 2007 Share Posted October 25, 2007 hi, in lots of scritp I see this: $this-> is that some function or simple variable? I ask that because in "code view" this "varible" have other color. thnx Link to comment https://forums.phpfreaks.com/topic/74709-this/ Share on other sites More sharing options...
AtomicNetwork Posted October 25, 2007 Share Posted October 25, 2007 "$this ->" is used to get variables internal to that object your currently residing in. You'll also notice that when using variables contained within a class, you can't use the $ to reference them - But you have to use it to reference the object itself. <?php class Page { var $Title; function DisplayTitle( ) { echo "<TITLE>" . $this->Title . "</TITLE>\n"; } } ?> Link to comment https://forums.phpfreaks.com/topic/74709-this/#findComment-377678 Share on other sites More sharing options...
rajivgonsalves Posted October 25, 2007 Share Posted October 25, 2007 The variable $this refers to the current instance of the class (object), this is mostly used in classes Link to comment https://forums.phpfreaks.com/topic/74709-this/#findComment-377684 Share on other sites More sharing options...
web_master Posted October 25, 2007 Author Share Posted October 25, 2007 wow, "this" need a deeper study for me thnx Atomic! Link to comment https://forums.phpfreaks.com/topic/74709-this/#findComment-377687 Share on other sites More sharing options...
AtomicNetwork Posted October 25, 2007 Share Posted October 25, 2007 Try the following link http://www.spoono.com/php/tutorials/tutorial.php?id=27 Link to comment https://forums.phpfreaks.com/topic/74709-this/#findComment-377689 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.