php_nub_qq Posted May 9, 2013 Share Posted May 9, 2013 public static $info=array(); private static $instance=null; public static function _new($fields = null){ if(self::$instance == null){ self::$instance = new User(); } if(!empty($fields) && !empty(self::$info['id'])){ self::$info = $this->getUserInfo(self::$info['id'], $fields); } return self::$instance; } self::$info = $this->getUserInfo(self::$info['id'], $fields); This is the line where I get " Fatal error: Using $this when not in object context " Why is that? Quote Link to comment Share on other sites More sharing options...
Solution ignace Posted May 9, 2013 Solution Share Posted May 9, 2013 $this is only available when you have instantiated an object. In a static content is $this not available. I think you mean: self::$info = self::$instance->getUserInfo(self::$info['id'], $fields); Quote Link to comment Share on other sites More sharing options...
php_nub_qq Posted May 9, 2013 Author Share Posted May 9, 2013 In the words of Homer Simpson - Doh! Quote Link to comment 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.