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. 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(); Link to comment https://forums.phpfreaks.com/topic/206357-need-help-understanding-this/#findComment-1079505 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.