dan_t Posted July 1, 2010 Share Posted July 1, 2010 I got this error: Fatal error: Using $this when not in object context What makes the $this work? where exactly should the $this be used, for that matter why is it used. I thought it was just a short cut for the current page your on, but now I'm not sure. Quote Link to comment https://forums.phpfreaks.com/topic/206357-need-help-understanding-this/ Share on other sites More sharing options...
premiso Posted July 1, 2010 Share Posted July 1, 2010 What makes the $this work? Being in an object context? Example: class test { public $item; public function echoItem() { echo $this->item; } } $cl = new test(); $cl->item = "blah"; $cl->echoItem(); Quote Link to comment https://forums.phpfreaks.com/topic/206357-need-help-understanding-this/#findComment-1079505 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.