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 Quote 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. Quote 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. Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/160691-php-this/#findComment-848160 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.