williamZanelli Posted June 2, 2009 Share Posted June 2, 2009 Hi guys, I'm a java programmer, and well versed with "this" and OO - but in PHP the $this is thowing me off.. Sometimes when I use it it throws an Error - does someone know of a tutorial that I could read that would help me understand this better? Or maybe send some examples my way, illustarting when I can or cant use $this Thanks Will Link to comment https://forums.phpfreaks.com/topic/160691-php-this/ Share on other sites More sharing options...
Maq Posted June 2, 2009 Share Posted June 2, 2009 There is an OOP reference in the manual - PHP5 OOP. Link to comment https://forums.phpfreaks.com/topic/160691-php-this/#findComment-848030 Share on other sites More sharing options...
keeps21 Posted June 2, 2009 Share Posted June 2, 2009 The $this is a built-in variable (built into all objects) which points to the current object. Or in other words, $this is a special self-referencing variable. You use $this to access properties and to call other methods of the current class. Link to comment https://forums.phpfreaks.com/topic/160691-php-this/#findComment-848151 Share on other sites More sharing options...
keeps21 Posted June 2, 2009 Share Posted June 2, 2009 See this video - http://www.killerphp.com/videos/oop_php_build_objects/build_objects_php_oop.html - it explains $this quiite well. But keep in mind that the video is using PHP4 syntax. Link to comment https://forums.phpfreaks.com/topic/160691-php-this/#findComment-848160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.